Skip to content

Commit

Permalink
[ssi] agent credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
patatoid committed Dec 22, 2024
1 parent 8b263d4 commit 63c44f2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
4 changes: 4 additions & 0 deletions apps/boruta_admin/assets/src/components/Forms/ClientForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<label>Access token TTL (seconds)</label>
<input type="number" v-model="client.access_token_ttl" placeholder="3600" />
</div>
<div class="field" :class="{ 'error': client.errors?.agent_token_ttl }">
<label>Agent token TTL (seconds)</label>
<input type="number" v-model="client.agent_token_ttl" placeholder="3600" />
</div>
<div class="field" :class="{ 'error': client.errors?.authorization_code_ttl }">
<label>Authorization code TTL (seconds)</label>
<input type="number" v-model="client.authorization_code_ttl" placeholder="60" />
Expand Down
4 changes: 4 additions & 0 deletions apps/boruta_admin/assets/src/models/client.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { addClientErrorInterceptor } from './utils'

const allGrantTypes = [
'client_credentials',
'agent_credentials',
'password',
'authorization_code',
'refresh_token',
Expand Down Expand Up @@ -49,6 +50,7 @@ const assign = {
key_pair_type: function ({ key_pair_type }) { this.key_pair_type = key_pair_type },
did: function ({ did }) { this.did = did },
access_token_ttl: function ({ access_token_ttl }) { this.access_token_ttl = access_token_ttl },
agent_token_ttl: function ({ agent_token_ttl }) { this.agent_token_ttl = agent_token_ttl },
authorization_code_ttl: function ({ authorization_code_ttl }) { this.authorization_code_ttl = authorization_code_ttl },
refresh_token_ttl: function ({ refresh_token_ttl }) { this.refresh_token_ttl = refresh_token_ttl },
id_token_ttl: function ({ id_token_ttl }) { this.id_token_ttl = id_token_ttl },
Expand Down Expand Up @@ -202,6 +204,7 @@ class Client {
get serialized () {
const {
access_token_ttl,
agent_token_ttl,
authorization_code_ttl,
authorization_request_ttl,
authorize_scope,
Expand Down Expand Up @@ -232,6 +235,7 @@ class Client {

return {
access_token_ttl,
agent_token_ttl,
authorization_code_ttl,
authorization_request_ttl,
authorize_scope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ defmodule BorutaAdminWeb.ClientView do
enforce_dpop: client.enforce_dpop,
enforce_tx_code: client.enforce_tx_code,
access_token_ttl: client.access_token_ttl,
agent_token_ttl: client.agent_token_ttl,
authorization_code_ttl: client.authorization_code_ttl,
authorization_request_ttl: client.authorization_request_ttl,
refresh_token_ttl: client.refresh_token_ttl,
Expand Down
2 changes: 1 addition & 1 deletion apps/boruta_auth/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule BorutaAuth.MixProject do

defp deps do
[
{:boruta, git: "https://github.com/malach-it/boruta_auth"},
{:boruta, git: "https://github.com/malach-it/boruta_auth", branch: "agent-credentials"},
{:logger_file_backend, "~> 0.0.13"},
{:quantum, "~> 3.0"}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule BorutaAuth.Repo.Migrations.AgentCredentials do
use Ecto.Migration

use Boruta.Migrations.AgentCredentials
end
14 changes: 13 additions & 1 deletion apps/boruta_web/lib/boruta_web/views/oauth_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ defmodule BorutaWeb.OauthView do
%Boruta.Oauth.TokenResponse{
token_type: token_type,
access_token: access_token,
agent_token: agent_token,
id_token: id_token,
c_nonce: c_nonce,
expires_in: expires_in,
Expand All @@ -147,12 +148,23 @@ defmodule BorutaWeb.OauthView do
) do
response = %{
token_type: token_type,
access_token: access_token,
expires_in: expires_in,
refresh_token: refresh_token,
c_nonce: c_nonce
}

response = case access_token do
nil -> response
access_token ->
Map.put(response, :access_token, access_token)
end

response = case agent_token do
nil -> response
agent_token ->
Map.put(response, :agent_token, agent_token)
end

response =
case id_token do
nil -> response
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"argon2_elixir": {:hex, :argon2_elixir, "2.4.1", "edb27bdd326bc738f3e4614eddc2f73507be6fedc9533c6bcc6f15bbac9c85cc", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "0e21f52a373739d00bdfd5fe6da2f04eea623cb4f66899f7526dd9db03903d9f"},
"asn1_compiler": {:hex, :asn1_compiler, "0.1.1", "64a4e52b59d1f225878445ace2c75cd2245b13a5a81182304fd9dc5acfc8994e", [:mix], [], "hexpm", "c250d24c22f1a3f305d88864400f9ac2df55c6886e1e3a030e2946efeb94695e"},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.1.0", "0b110a9a6c619b19a7f73fa3004aa11d6e719a67e672d1633dc36b6b2290a0f7", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "2ad2acb5a8bc049e8d5aa267802631912bb80d5f4110a178ae7999e69dca1bf7"},
"boruta": {:git, "https://github.com/malach-it/boruta_auth", "be856cb4b213efdb5c9c71ad4451b32e89263ea7", []},
"boruta": {:git, "https://github.com/malach-it/boruta_auth", "c95932a92f229605ca852297618ab4f95cf32e64", [branch: "agent-credentials"]},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"},
"castore": {:hex, :castore, "1.0.9", "5cc77474afadf02c7c017823f460a17daa7908e991b0cc917febc90e466a375c", [:mix], [], "hexpm", "5ea956504f1ba6f2b4eb707061d8e17870de2bee95fb59d512872c2ef06925e7"},
Expand Down

0 comments on commit 63c44f2

Please sign in to comment.