Skip to content

Commit

Permalink
[admin] fix defered field in file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
patatoid committed Jan 24, 2025
1 parent ff62f81 commit 1baf550
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
1 change: 0 additions & 1 deletion apps/boruta_admin/priv/examples/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ configuration:
verifiable_credentials:
- version: "13"
credential_identifier: BorutaCredentialSdJwt
defered: false
format: vc+sd-jwt
types: VerifiableCredential BorutaCredentialSdJwt
claims:
Expand Down
70 changes: 70 additions & 0 deletions apps/boruta_admin/test/boruta_admin/configuration_loader_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,74 @@ defmodule BorutaAdmin.ConfigurationLoaderTest do
assert %ErrorTemplate{type: "500", content: "test"} =
BorutaIdentity.Repo.all(ErrorTemplate) |> List.last()
end

test "loads example file" do
assert BorutaGateway.Repo.all(Upstream) |> Enum.empty?()

Application.delete_env(ConfigurationLoader, :node_name)

configuration_file_path =
:code.priv_dir(:boruta_admin)
|> Path.join("/examples/configuration.yml")

ConfigurationLoader.from_file!(configuration_file_path)

assert %Backend{
name: "Example backend",
id: "00000000-0000-0000-0000-000000000001",
verifiable_credentials: [
%{
"claims" => [
%{
"label" => "boruta username",
"name" => "boruta_username",
"pointer" => "email"
}
],
"credential_identifier" => "BorutaCredentialSdJwt",
"display" => %{
"background_color" => "#ffd758",
"logo" => %{
"alt_text" => "malachit logo",
"url" => "https://io.malach.it/assets/images/logo.png"
},
"name" => "Boruta username (SD-JWT)",
"text_color" => "#333333"
},
"format" => "vc+sd-jwt",
"types" => "VerifiableCredential BorutaCredentialSdJwt",
"version" => "13"
}
]
} = BorutaIdentity.Repo.all(Backend) |> List.last()

assert %IdentityProvider{
id: "00000000-0000-0000-0000-000000000001",
backend_id: "00000000-0000-0000-0000-000000000001",
name: "Example identity provider",
consentable: true,
choose_session: true,
registrable: true
} =
BorutaIdentity.Repo.all(IdentityProvider)
|> List.last()
|> BorutaIdentity.Repo.preload(:templates)

assert %Client{
id: "00000000-0000-0000-0000-000000000001",
name: "Example client",
redirect_uris: ["https://redirect.uri.boruta"],
} = BorutaAuth.Repo.all(Client) |> List.last()

# assert %ClientIdentityProvider{
# client_id: "00000000-0000-0000-0000-000000000001",
# identity_provider_id: "00000000-0000-0000-0000-000000000001",
# } = BorutaAuth.Repo.all(ClientIdentityProvider) |> List.last()

assert %Scope{
name: "BorutaCredentialSdJwt",
label: "boruta username",
public: true
} = BorutaAuth.Repo.all(Scope) |> List.last()
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ defmodule BorutaIdentity.IdentityProviders.Backend do
"version",
"credential_identifier",
"format",
"defered",
"types",
"claims",
"display"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ defmodule BorutaIdentity.IdentityProviders.IdentityProvider do
|> validate_required([:name, :backend_id])
|> unique_constraint(:name)
|> cast_assoc(:templates, with: &Template.assoc_changeset/2)
|> foreign_key_constraint(:backend_id, name: :identity_providers_backend_id_fkey)
end

@doc false
Expand Down

0 comments on commit 1baf550

Please sign in to comment.