-
Notifications
You must be signed in to change notification settings - Fork 170
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
In OIDC verify that the JWT token type is "Bearer" #643
Comments
Would be good to provide examples for those tokens (decoded and sanitized are fine). Also I'll need a spec/RFC to follow. If this is not specified anywhere, then how other implementations work? We need to follow some specified standard. |
Example tokens: Bearer
Refresh:
ID:
|
@mikz I couldn't find any specs or examples. Keycloak itself does something like this: or |
So I did some research and I think we should be using The But I got the impression that edit: That makes me thing if we should validate the tokens by calling the IDP introspect endpoint. Because looks like the access token does not have to be a JWT (by the OIDC spec) and it should be treated as opaque string. |
@mikz but It seems indeed that there is no standard way to validate the type of token, but it looks like we can safely assume that Keycloak validates based on The only standard and reliable way would of course be token instrospection, but I think we could rely on this non-standard |
@mayorova I don't want this to be Keycloak specific. Support for more IDPs is going to come in next version and I don't want to implement a workaround for every IDP. So if we need to do this then we need one way for all of them. Either configuring the IDP to use Edit: |
I agree this should be done as the spec defines it. So firstly we should be validating the correct claim in the JWT which for an As for verifying the type of token there is nothing in the spec that states we should reject certain types of tokens. However, I still think it is correct/makes sense to reject Refresh & Id tokens as they are meant for the authorisation server and client respectively. Neither of which APIcast proxy passes requests to so this should just be a well-documented behaviour of the gateway. |
We are already doing it :) |
My proposal for this release is to modify the Token introspection policy to:
And then the workaround should be just be just adding that policy to validate the token by token introspection. For the next release I'd go with offering customization for the oidc authorization process so customers can define how the access token should be verified to support cases when |
@mayorova yeah that's my point, we can continue to do that. There's no reason why it should just be a validation of that one claim at least whilst keycloak is doing it this way. I guess we are in agreement on this point then :) @mikz yes I think this is going to be the majority of use cases rather than introspection on every call. I assume that the config used is the "main" apicast config then and not the |
@kevprice83 I probably don't get you question. The Token introspection policy should not require configuration when OIDC is used, because it can get its configuration through OIDC discovery the same way as APIcast Policy does. |
So I've tried to use the Token introspection endpoint of Keycloak and managed to get a response. Keycloak stubbornly returns Guess the next best solution would be to add jwt validator that verifies |
Currently APIcast will just check the type of token in the
Authorization
header, so requests like this will fail:However, it is possible to pass a token which is NOT a bearer token like this:
The request will succeed, as the refresh token has the claims required by APIcast. The same with ID token. However, this doesn't sound right.
Red Hat Single Sign-On includes the claim
"typ"
to identify the type of tokenIt doesn't seem to be included in the specifications:
However, Red Hat Single Sign-On itself validates the type of the token, and in case it is not correct, it returns a:
I think APIcast should also check that the value of the
"typ"
claim isBearer
and the token is send asBearer
in theAuthorization
header.The text was updated successfully, but these errors were encountered: