-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add Opaque Token Validation Support for Servlet Web Application Type #185
Add Opaque Token Validation Support for Servlet Web Application Type #185
Conversation
The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JAVA-COMBEUST-174815
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOAuth2Configurer.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOAuth2Configurer.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/config/OktaOAuth2Properties.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOAuth2AutoConfig.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOpaqueTokenIntrospector.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/config/OktaOAuth2Properties.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/config/OktaOAuth2Properties.java
Outdated
Show resolved
Hide resolved
...java/com/okta/spring/boot/oauth/env/OktaOAuth2PropertiesMappingEnvironmentPostProcessor.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOAuth2ResourceServerAutoConfig.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOAuth2ResourceServerAutoConfig.java
Outdated
Show resolved
Hide resolved
Are there changes to support WebFlux in this PR? |
49fe956
to
8476284
Compare
I would introduce them as part of a separate JIRA/PR (OKTA-336738). |
Ready for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple nits,
Some of which should be resolved by #207.
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOAuth2Configurer.java
Outdated
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/WebClientUtil.java
Outdated
Show resolved
Hide resolved
@@ -265,7 +261,8 @@ class AutoConfigConditionalTest implements HttpMock { | |||
webContextRunner().withPropertyValues( | |||
"okta.oauth2.issuer=https://test.example.com/", | |||
"spring.security.oauth2.client.provider.okta.issuerUri=${mockBaseUrl()}", // work around to not validate the https url | |||
"okta.oauth2.client-id=test-client-id") | |||
"okta.oauth2.client-id=test-client-id", | |||
"okta.oauth2.client-secret=test-client-secret") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the test propertyokta.oauth2.issuer
to be something that the previous code was expected (so the test functions the same way), then add a new test (if needed for the newer code)
This will ensure the previous functionality continues to work unchanged
...om/okta/spring/boot/oauth/env/OktaOAuth2PropertiesMappingEnvironmentPostProcessorTest.groovy
Outdated
Show resolved
Hide resolved
...om/okta/spring/boot/oauth/env/OktaOAuth2PropertiesMappingEnvironmentPostProcessorTest.groovy
Show resolved
Hide resolved
oauth2/src/main/java/com/okta/spring/boot/oauth/OktaOAuth2Configurer.java
Outdated
Show resolved
Hide resolved
Updated conditional property logic to take a list of strings, this ensures that BOTH issuer and secret are set before remapping properties
bb6cbba
to
dc6cd54
Compare
fixed. |
This probably isn't any better, but there were a couple that said `withIssuer` but didn't mention client id & secret
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Issue:
OKTA-323350
Expected behavior implemented in this PR:
ℹ️ Note: When the server is configured/set to start in Opaque Token mode, if the property
okta.oauth2.client-secret
is not set (empty), then the startup would fail with error and this is the desired behavior. This is because, we will need the client-secret at runtime to hit the introspection endpoint to validate the Opaque token and we do not want the user to see a 401 error at that stage with a missing client-secret. To prevent that, we are validating that before the server startup and would not let the server to start in such a case.Note: This covers only Servlet web application type (does not cover "Reactive/Webflux" applications).