-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct the principle username detection for OAuth 2.0 Client Credentials grant #946
Comments
This one and these other two...
...Will be what I would like to pick your brains on @petergphillips @andymarke, whenever we get a chance to talk off line. |
For endpoints that create data you need to provide an extra parameter when you create the client credentials of |
Thank you @petergphillips,
I will give that a shot in a few. I guess that's an example of what they call "Implicit Knowledge" (aka, "Tribal Knowledge"). Right? Because I haven't seen that documented anywhere. And I've read a ton of stuff so far about several different HMPPS/MOJ/DPS projects. Please correct me if I'm wrong though. Please point me to the documentation of that, that I overlooked? TIA. |
I will proceed on the assumption that "ITAG_USER" is one such Or can you share any shortcuts to getting a hold of a known |
Dear "other future non-DPS devs", I am pleased to report that "ITAG_USER" is, indeed, one such I confirmed that, @petergphillips, with two
Now that leaves only the Spring Security OAuth 2.0 client credentials configuration so that it does those two things on my behalf, under the covers. Right @petergphillips? If you could share any shortcuts for (or even better, links to documentation of) that configuration, that'd be so super deluxe! TIA. |
The Customizing the Access Token Request section of the Spring Security OAuth 2.0 reference documentation offers some pretty decent guidance. I'm reasonably certain as far as the "What" needs to be customized goes. My first stab at the specifics (i.e., the "How") still needs a little more work though. In the meantime, any links to hints, tips or suggestions are welcome @petergphillips. TIA. |
I've worked out a now-working configuration @petergphillips. I found the missing piece of the puzzle in the Spring Security JavaDoc...
The Spring Security OAuth 2.0 configuration I now have in place, now programmatically does the needful "...provide an extra parameter when you create the client credentials of Thanks again for sharing that |
Sorry for the delay. An example of where we configure the web client to add the |
Expected Behavior
When the
/api/offenders/{offenderNo}
endpoint is called, anOFFENDER_BOOKINGS
record should be created in persistent storage.Current Behavior
The system fails to create the
OFFENDER_BOOKINGS
record (full stack trace)...Context
I am an external developer of a non-DPS system. My application is specified to consume API endpoints exposed by this project. My application will be authorized by HMPPS Auth using the OAuth 2.0 Client Credentials grant.
While stepping through the debugger during investigation of a separate, unrelated issue, I had observed that Spring Security refers to the security principle as "
AnonymousUser
" during the OAuth 2.0 Client Credentials grant flow.Assuming that an "
AnonymousUser
" would not have a user name, then the following two lines are reasonable suspects for the root cause of the reported "The given id must not be null
" error...(username = ((UserDetails) userPrincipal).getUsername();)
staffUserAccountRepository.findById(currentUsername)
Steps to Reproduce
/api/offenders/{offenderNo}
endpoint with a JWT access token issued by HMPPS Auth for an OAuth 2.0 Client Credentials grant.Your Environment
The text was updated successfully, but these errors were encountered: