Skip to content

Commit

Permalink
fix: issues with OIDC strategy (#800)
Browse files Browse the repository at this point in the history
* Make OIDC dsl available

* Fix OIDC configuration validation.

Assent uses strings for the client_authentication_method. Therefore
changed the DSL to use string as well, in stead of atoms.

* Set correct provider for OIDC
  • Loading branch information
schutm authored Oct 17, 2024
1 parent 2c4a3d7 commit fa1a258
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/ash_authentication/strategies/oidc.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ defmodule AshAuthentication.Strategy.Oidc do
alias AshAuthentication.Strategy.{Custom, Oidc}
use Custom, entity: Dsl.dsl()

@doc false
defdelegate dsl, to: Dsl
defdelegate transform(strategy, dsl_state), to: Oidc.Transformer
defdelegate verify(strategy, dsl_state), to: Oidc.Verifier
end
4 changes: 2 additions & 2 deletions lib/ash_authentication/strategies/oidc/dsl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ defmodule AshAuthentication.Strategy.Oidc.Dsl do
],
client_authentication_method: [
type:
{:in, [:client_secret_basic, :client_secret_post, :client_secret_jwt, :private_key_jwt]},
default: :client_secret_basic,
{:in, ["client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt"]},
default: "client_secret_basic",
doc: "The client authentication method to use.",
required: false
],
Expand Down
1 change: 1 addition & 0 deletions lib/ash_authentication/strategies/oidc/transformer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule AshAuthentication.Strategy.Oidc.Transformer do
def transform(strategy, dsl_state) when strategy.nonce == true do
strategy
|> Map.put(:nonce, {NonceGenerator, []})
|> Map.put(:provider, :oidc)
|> OAuth2.transform(dsl_state)
end

Expand Down

0 comments on commit fa1a258

Please sign in to comment.