You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add constructor to JwtAuthenticationToken that takes a principal nameΒ #6865
This encourages composition over inheritance while also keeping the application from having to create a custom class to override this default behavior.
I'd like to submit a PR for this issue. Taking a look at JwtAuthenticationToken it doesn't currently have a name value like OAuth2IntrospectionAuthenticationToken does. I also noticed that currently getName returns the tokens subject. Should I be creating a new name variable or setting something somewhere else?
Sorry if silly question, first time around here :)
@HaydenMeloche if I understand correctly, you will be mimicking the OAuth2IntrospectionAuthenticationToken by adding name and introducing the suggested constructor.
As far the getName question, if you look at OAuth2IntrospectionAuthenticationToken constructor the line this.name = name == null ? (String) attributes.get(SUBJECT) : name; does the trick of either setting the provided name (if not null) or defaulting to attributes.get(SUBJECT) so when the getName() returns this.name it is either of the two hence, functioning the same way as OAuth2IntrospectionAuthenticationToken.
You might be able to provide a PR for this since it is tagged with first-timers-only and no one has claimed it yet π
I am not part of Spring team but, I felt like I could answer your questions and I hope I did not confuse you π
Activity
HaydenMeloche commentedon May 16, 2019
I'd like to submit a PR for this issue. Taking a look at
JwtAuthenticationTokenit doesn't currently have anamevalue likeOAuth2IntrospectionAuthenticationTokendoes. I also noticed that currentlygetNamereturns the tokens subject. Should I be creating a new name variable or setting something somewhere else?Sorry if silly question, first time around here :)
rhamedy commentedon May 17, 2019
@HaydenMeloche if I understand correctly, you will be mimicking the
OAuth2IntrospectionAuthenticationTokenby addingnameand introducing the suggestedconstructor.As far the
getNamequestion, if you look atOAuth2IntrospectionAuthenticationTokenconstructor the linethis.name = name == null ? (String) attributes.get(SUBJECT) : name;does the trick of either setting the provided name (if not null) or defaulting toattributes.get(SUBJECT)so when thegetName()returnsthis.nameit is either of the two hence, functioning the same way asOAuth2IntrospectionAuthenticationToken.You might be able to provide a PR for this since it is tagged with
first-timers-onlyand no one has claimed it yet πI am not part of
Spring teambut, I felt like I could answer your questions and I hope I did not confuse you πjzheaux commentedon May 20, 2019
@HaydenMeloche welcome! Yes, @rhamedy's analysis is correct, and yes, it'd be great to see a PR from you.
HaydenMeloche commentedon May 23, 2019
I believe this issue can be closed now.
#6893
jzheaux commentedon May 24, 2019
Closed via f84ab3a