feat: allow to disable claim mirroring#3563
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3563 +/- ##
==========================================
+ Coverage 76.24% 76.34% +0.10%
==========================================
Files 132 132
Lines 9901 9888 -13
==========================================
Hits 7549 7549
+ Misses 1837 1824 -13
Partials 515 515
|
hperl
left a comment
There was a problem hiding this comment.
This looks very good already, thanks for the contribution!
I had only one remark, please see below.
oauth2/session.go
Outdated
| } | ||
|
|
||
| func NewSessionWithCustomClaims(subject string, allowedTopLevelClaims []string) *Session { | ||
| func NewSessionWithCustomClaims(subject string, allowedTopLevelClaims []string, mirrorTopLevelClaims bool) *Session { |
There was a problem hiding this comment.
Instead of passing each config option, we could pass the configuration provider here and read out the config values in the function body.
There was a problem hiding this comment.
Thanks @hperl. The methods on the config provider require the context. So I've changed the signature to accept ctx first followed by the config provider.
hperl
left a comment
There was a problem hiding this comment.
LGTM, thank you for the contribution 🎉
This PR introduces another config option called
oauth2:mirror_top_level_claimswhich may be used to disable the mirroring of custom claims into theextclaim of the jwt.This new config option is an opt-in. If unused the behavior remains as-is to ensure backwards compatibility.
Example:
Related issue(s)
#3348
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
security@ory.sh) from the maintainers to push
the changes.
works.