Repository navigation
Add oidcc_authorization:validate_iss_parameter/2 for RFC 9207 - #580
Open
ardraayyappath wants to merge 3 commits into
Open
ardraayyappath wants to merge 3 commits into
ardraayyappath wants to merge 3 commits into
Conversation
oidcc does not handle the authorization callback, so RFC 9207 issuer validation has to happen in the caller. Add a helper that applies the RFC 9207 rules against the client context (honouring issuer_regex), expose it in Oidcc.Authorization, and point to it from the README.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
oidccleaves the authorization callback to the caller, so RFC 9207 issuer validation has to happen there.oidcc_plugdoes this in its callback, but anyone writing their own callback (plain Erlang, Cowboy, a customPlug) has to reimplement the rules. This adds a small helper so they don't have to:
Behaviour (RFC 9207 §2.4):
issin the callbackauthorization_response_iss_parameter_supportedok{error, {invalid_iss_parameter, Iss}}true{error, missing_iss_parameter}falseokIf the
issuer_regexquirk is configured,issis matched against it, the same way the ID tokenissclaim is.
Changes:
src/oidcc_authorization.erl:validate_iss_parameter/2and theiss_error()type.lib/oidcc/authorization.ex:Oidcc.Authorization.validate_iss_parameter/2(takesnilfor absent).README.md: the RFC 9207 entry now says where the check happens (this helper, oroidcc_plug).test/oidcc_authorization_test.erlcovers every row above plusissuer_regex;test/oidcc/authorization_test.exssmoke-tests the Elixir wrapper (plus a doctest).Testing (OTP 29 / Elixir 1.20):
rebar3 fmt --checkclean,rebar3 eunit149 tests 0 failures,rebar3 dialyzerclean,mix format --check-formattedclean,mix test82 passed.I used
since: 3.10.0. Happy to change that, the names, or the error atoms. If this is wanted, afollow-up for
oidcc_plugcould call it too. That would also compare a presentisswhen the providerdoesn't advertise support, which RFC 9207 asks clients to do.