-
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
Support PKCE client flows #132
Comments
From the Spring Security 5.2.0 docs:
I tried the following in
This results in:
I also tried using Okta properties:
However, this results in the same error. |
I am also having issues using Okta spring boot v1.2.1 with boot 2.1.4.RELEASE. I have no |
Hey @jasonrberk! |
Yes, this is what I'm doing and my resource server is still 401ing me. In
my JS app I'm getting a token as I expected.... I just can't seem to get
the okta starter to validate the token.
…On Thu, May 21, 2020, 11:40 PM Brian Demers ***@***.***> wrote:
Hey @jasonrberk <https://github.com/jasonrberk>!
I think Matt might have mentioned this on another thread, but you don't
need PKCE support for resource servers, you would only use PKCE where you
are getting the token. Once you have the token you just send it to your
resource server in a header Authorization: Bearer <your-access-token>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#132 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHSZMNKODIMKM2K4725IT7LRSXX3LANCNFSM4HULQOKQ>
.
|
I'd suggest isolating the front end vs the backend. Can you access your resource server using curl/httpie? If that fails in the same way. My next suggestion is to turn up the logging in your spring boot app. Spring Security by default doesn't log much (for good reason), setting the root log level to My next suggestion would be to include the decoded token from: https://www.jsonwebtoken.io/ |
that's what I'm trying to do now....
that's how I'm testing my API.....I'm cURL'ing it with my token and only getting a 401
I'll give that a shot...
my decoded (and edited) token:
|
spring security debug logs show this error: Authentication request for failed: org.springframework.security.oauth2.core.OAuth2AuthenticationException: An error occurred while attempting to decode the Jwt: Couldn't retrieve remote JWK set: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found |
Ahh, the issuer is the problem. This type of toke is from the root Okta issuer, and cannot be validated as a JWT (even though it is formatted as one). You need to use one formatted as I mentioned above. Access tokens are opaque strings per the OAuth spec, and are validated remotely. You can do this with Spring Boot/Security out of the box (without the Okta Starter), by configuring the resource server to be “opaque”. Typically we just recommend to use a “custom” authorization server though. (I’m typing on my phone otherwise a I’d dig up an example) Keep us posted! |
… On Fri, May 22, 2020, 2:02 PM Brian Demers ***@***.***> wrote:
Ahh, the issuer is the problem. This type of toke is from the root Okta
issuer, and cannot be validated as a JWT (even though it is formatted as
one). You need to use one formatted as I mentioned above.
Access tokens are opaque strings per the OAuth spec, and are validated
remotely. You can do this with Spring Boot/Security out of the box (without
the Okta Starter), by configuring the resource server to be “opaque”.
Typically we just recommend to use a “custom” authorization server though.
(I’m typing on my phone otherwise a I’d dig up an example)
Keep us posted!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#132 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHSZMNMHNH4TC7IOWTCDWGLRS244FANCNFSM4HULQOKQ>
.
|
I want my API (resource server) to only allow requests from callers that have an access token issued by okta specifically to users of my SPA. sounds like I need to create users and groups in Okta, and an "application"....tie these altogether and setup an Auth Server that is tied to the client ID of my app. the key for me, is that ONLY the users who authenticate with Okta for MY CLIENT should be allowed to access the resource server. An access token issued by my okta instance alone is not good enough. In other words, an access token received when using SPA "foo" would not allow you to call the API for the "bar" resource server. Only the token provided when logging in to SPA "bar" would pass the auth test. make sense? |
Yes, using a custom Authorization Server fils this exact use case. My suggestion would be to create an Auth server and set the “audience” to something specifics for your app, then configure this starter to validate against that. |
@bdemers can you help me with https://stackoverflow.com/questions/62227762/spring-security-filter-issues. It appears as if the filter created by the okta starter is being greedy |
Client support for PKCE has been added in the next Spring Security Release
We have a few places we check if the client-secret is set. This needs to be removed and ONLY check for
client-id
. All that is needed is an issuer and a client-id (assuming PKCE is enabled)The text was updated successfully, but these errors were encountered: