-
Notifications
You must be signed in to change notification settings - Fork 49
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 DPoP proofing mechanism #165
Comments
@acoburn Hi, thanks for this proposal. Please give me some time before I will comment further. Cheers |
@acoburn I've read the description, it is very clearly typed, and makes sense IMHO. |
@sberyozkin thanks for the feedback. Using an abstract class, as you propose, makes a lot of sense, and that should be reasonably straight-forward to implement. |
@acoburn Hi, have you had a chance to do some prototype ? thanks |
@sberyozkin thanks for the ping. I have done some initial work on this. I'll try to wrap that up and submit as part of a PR |
@acoburn Nice, would be good to see it, please take your time |
Resolves smallrye#165 This adds the initial structure for handling proof of possession semantics at the application layer.
Resolves smallrye#165 This adds the initial structure for handling proof of possession semantics at the application layer.
Now that custom token schemes are supported, this issue is to discuss adding a DPoP verifier to the smallrye-jwt code. We could also discuss implementing this as a quarkus extension, but I'd like to propose implementing the verifier at this layer.
The approach that I'd like to propose would be implemented as a
i.s.j.auth.jaxrs.DPoPAuthenticationFilter
class. This filter would have a@Priority(AUTHENTICATION)
and perform the following validation steps:DPoP
header, if one existshtm
(HTTP Method) claim matches the method from the JAX-RS request contexthtu
(HTTP URI) claim matches the URI from the JAX-RS request contextcnf
(confirmation) claim of the access token (the injectedJsonWebToken
)The DPoP draft specification does not define how to handle error conditions, should validation fail, but I would propose returning a
401 Unauthorized
, since that's what this library already returns when a token can't be validated.The Proof-of-Possession Key Semantics specification defines several ways that an access token can represent confirmation claims, including:
"cnf": { "jkt": "SHA-256 thumbprint" }
"cnf": { "jwk": { ... } }
"cnf": { "jku": "URL of JWKS", "kid": "key-identifier" }
"cnf": { "kid": "key-identifier" }
I would like to propose supporting only the first two options. One of the nice features of DPoP is that it is self-contained and makes use of ephemeral keys, and the third option conflicts with both of those features. The fourth option is complicated because it would require that resource servers have extra out-of-band knowledge and it has questionable practicality in this context.
One part of this that could use some discussion relates to how to prevent against downgrade attacks. Since it would be important to continue supporting regular Bearer tokens in addition to DPoP, one should consider the case where an
Authorization: DPoP <token>
header gets replayed asAuthorization: Bearer <token>
without the addedDPoP
header. Typically, one would want to reject this request, but this assumes that thecnf
claim is not being used for any other purpose, and I'm not sure that's a safe assumption in the general case. I suspect the simplest way to address this is the following:By default, DPoP proofing is entirely disabled, but it can be enabled via an MP-config value (e.g.
smallrye.jwt.enable.dpop
). If enabled and if the access token contains acnf
claim, then the DPoP filter becomes relevant. At that point, if the token scheme isBearer
, the request can be denied. But if the access token does not contain acnf
claim, then the token is treated as a simple bearer token and DPoP validation doesn't come into play at all.If this seems like a reasonable approach, I can implement it.
The text was updated successfully, but these errors were encountered: