Skip to content
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

Update to Spring Boot 2.4.0 #214

Merged
merged 5 commits into from
Nov 20, 2020
Merged

Update to Spring Boot 2.4.0 #214

merged 5 commits into from
Nov 20, 2020

Conversation

bdemers
Copy link
Contributor

@bdemers bdemers commented Nov 13, 2020

A few things change in Spring Security 5.4 (used by Spring Boot 2.4)

  1. The default WebSecurityAdapter (or equivalent, now configures a "login" or a "resource server", not both by default
  • this change restores that functionality
  1. PKCE for unauthenticated clients looks to be NOT configured by default
  • though I might be missing something there, open question to the Spring Security team on Gitter
  1. Default OAuth scopes are NO longer set by Spring Security
  • this change restores that functionality, setting them to the previous default of: openid, profile, email
  1. It's now easier to set the JWT converter, you can just inject it!
  2. Minor test changes (we have tests that poke at the internals of spring sec, these often need to change when implementation details change)

@bdemers
Copy link
Contributor Author

bdemers commented Nov 13, 2020

@arvindkrishnakumar-okta can you restart that failing CI job, it looks like a network error on Travis (while downloading maven artifacts)

@@ -67,4 +67,5 @@ scenarios:
- --okta.oauth2.scopes=offline_access
# - --okta.oauth2.redirectUri=/authorization-code/callback # not implemented until Spring Sec 5.2
- --server.servlet.session.tracking-modes=cookie
- --spring.security.oauth2.client.registration.okta.client-authentication-method=none
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mraible looks like this is one of the things that changed in the latest version of Spring Security (I've got a question on the Spring Sec Gitter to confirm this)

This prop needs to be set in order for PKCE (for clients without secrets) to work. Assuming this is correct, any thoughts on pushing this down to the user like this? or should we re-map it to okta.oauth2.client-authentication-method=none, or... should we just detect this condition and configure it automatically (to insure the previous functionality)

(PKCE still isn't used for clients with secrets, that that's another thread...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would configure it automatically, then document it. That way, it's a seamless upgrade for folks. As far as I know, you can configure Spring Boot as a resource server with only an issuer. I'm not sure folks will know that an issuer and a client ID means it'll use PKCE. A lot of our JS SDKs have a pkce flag that you can turn off. Does it make sense to add an okta.oauth2.pkce property?

@arvindkrishnakumar-okta
Copy link
Contributor

@arvindkrishnakumar-okta can you restart that failing CI job, it looks like a network error on Travis (while downloading maven artifacts)

done

http.authorizeRequests((requests) -> requests.anyRequest().authenticated());
http.oauth2Login(Customizer.withDefaults());
http.oauth2Client();
http.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, I noticed they use withDefaults() for login, client, and resource server. Not sure what that does, but thought I'd mention it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked withDefaults(), just adds a no-op "customizer"

@@ -47,7 +47,6 @@ scenarios:
- --okta.oauth2.issuer=https://localhost:${mockHttpsPort}/oauth2/default
- --okta.oauth2.clientId=OOICU812
- --okta.oauth2.clientSecret=VERY_SECRET
- --okta.oauth2.scopes=profile,email,openid
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a quick note in the commit, but this ensures, that the default scopes ARE picked up (as the ITs will validate these scopes are present)

Spring Sec 5.4 allows for this logic to just be a bean!
* lots of cleanup
* removed explicit setting of scopes in default scopes testRunner.yml, to ensure that path is covered by tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants