-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
oauth2: Support for Pairwise Subject Identifier Type #950
Comments
That's a sensible request. I think there are two ways to support this (we can combine both):
As we're implementing the OIDC Dynamic Client Registration, clients need to specify This might actually be something we'd like to configure using an environment variable, which could be something along the lines of What do you think? |
Note to self: This should work with |
This is exactly what I was going to suggest, good job! I fully agree, both ways should be available to us, especially since we might need to have full control over the creation of the "external subject". This is an option I would prefer to follow in the first place, hoping that Hydra wouldn't validate nor enforce the given value (Hydra shouldn't know anything about the algorithm we are using, right?). When it comes to the topic of supporting both types (public, pairwise) at the same time, I can't find a valid use case for now, perhaps it may come handy in the future? If you decide to support both types at the same time per client, we would need a flag to determine which subject_type is used during the authentication phase. I don't mind becoming a beta tester of this future. Thanks! |
Both solutions sound good to me. |
That's a good point, we'll add this to the things to think about when implementing this.
If both types are supported by the server, then the proper algorithm is chosen by checking the |
This patch introduces field `subject_type` to OAuth 2.0 Clients. See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
This patch introduces field `subject_type` to OAuth 2.0 Clients. See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
@arekkas I've just took a sneak peek at the referenced commits, it looks solid! I'm wondering which option you are going to follow in the first place? Supporting the "externally provided" subject passed directly to hydra? |
The idea is to have both. One of the ideas is to have a resolver that associates the pairwise ID with the "real ID". It's a bit complicated though as many use cases (e.g. id_token_hint) need to be supported. |
This patch introduces field `subject_type` to OAuth 2.0 Clients. See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
This is kinda tricky to implement. The idea would be the following:
This means that on consecutive login flows you will always receive the "raw"/"true" subject ID. So the "internal" view will be untouched while the "external" / public view would be different depending on the subject algorithm. @michalwojciechowski another idea is to add an endpoint like Another idea is to return the true subject ID on token introspection. Do you really need to be able to have full control over setting the subject ID? As far as I understood the thinking behind it was to be able to resolve the subject ID. This could be achieved with the ideas mentioned above. |
See #950 Signed-off-by: arekkas <[email protected]>
The This in turn implies that only the ID Token and the userinfo payloads have to adhere to the pairwise algorithm. This in turn makes the process for the access/refresh tokens completely uninteresting. I am assuming that you need to be able to resolve the
Am I assuming this correctly? |
One issue persists though. Assuming we are issuing a JSON Web Token as access token - the |
I checked how other libraries solve this. node-oidc-provider has a different subject ID in the introspection response too. I think they are wrong though, the introspection is really to fetch metadata about a subject from the PROVIDER side, not the consumer (client). Thus it doesn't make sense to have the pairwise subject in the introspection response. This gets muddier with JWTs where the sub is actually transparent to the clients (that's why I don't like JWT for access tokens...) but I think it's legitimate to (at least for now) disable JWTs with pairwise config. It's a bit dirty but then again JWTs as access tokens are dirty and it removes development overhead which makes hitting the deadline more realistic. |
@michalwojciechowski @damian0o could you please comment on #950 (comment) ? Otherwise I'll move on with the implementation laid out in #950 (comment) #950 (comment) |
This patch introduces field `subject_type` to OAuth 2.0 Clients. See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
I believe additional flow is that when 3rd party developer is calling token introspection endpoint and get full access token. Subjects between access token and id token should match. |
I disagree. OAuth 2.0 Token Introspection has a clear definition of who's calling:
* protected resource = resource on the resource provider (your first-party API)
To me, it is very clear what the intention of OAuth 2.0 Token Introspection is. It is for your first-party resource provider (basically your API or API Gateway) to check if the access token is valid and if so, what metadata is associated with it. For the resource server it makes no sense to have an obfuscated user id ( |
By the way, this is also the reason why there is no public OAuth 2.0 Token Introspection endpoint Google, Microsoft, Amazon, Dropbox, Facebook, ... (you name it). |
Well played card with mentioning Google, Microsoft others. I believe some of our clients can also turn into 3rd party resources providers and in this case we would like to preserve this pairwise algorithm in access tokens as well. |
If a 3rd party wants to expose their APIs to other 3rd parties (or 4th parties? 😃) they should have their own authorization infrastructure in place:
So in the case that "mybank" now exposes resource providers (let's just call that "mybank API" for now):
From my understanding, there is no need for introspection here anywhere. Authentication is done via OIDC. Authorization is done (at the first party) via introspection. Authorization for the third party / relying party / client is done in the client and completely independent and isolated from your authorization infrastructure. |
As discussed on the phone we'll add an additional field to the OAuth 2.0 Token Introspection |
This patch introduces field `subject_type` to OAuth 2.0 Clients. See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
This patch introduces the OpenID Connect pairwise Subject Identifier Algorithm. Closes #950 Signed-off-by: arekkas <[email protected]>
This patch introduces the OpenID Connect pairwise Subject Identifier Algorithm. Closes #950 Signed-off-by: arekkas <[email protected]>
This patch introduces field `subject_type` to OAuth 2.0 Clients. See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
See #950 Signed-off-by: arekkas <[email protected]>
Just a side note on Access token subject field. How this should work with OAUTH2_ACCESS_TOKEN_STRATEGY=jwt. |
The JWT strategy does not support the pairwise algorithm at the moment. It's one of the problems which I have been advocating for a while (transparent access token metadata) with regards to JSON Web Tokens as access tokens, but now it's a real effect. There is currently no way of making this work with the JWT strategy because the access token state is regarded as internal. Internal resources however must be able to resolve the user ID from the access token which is not possible with a one-way hashing algorithm like the one we're using (SHA-256). So there is no way really to make this work. tl;dr there is currently no way to make this work with JWTs natively in ORY Hydra. If you try to use both (JWT + Pairwise) then OAuth2 flows will fail. |
Do you want to request a feature or report a bug?
A new feature.
What is the expected behavior?
It would be great to see Hydra supporting Pairwise Subject Identifier Type for the clients who define subject_types_supported = pairwise only. Ideally we would like see all the features listed on http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes to be present with the following concerns:
As a POC we've tried to manually modify the subject after the authentication flow is done, unfortunately Hydra does not support it & ends the following error message: "Subject from payload does not match subject from previous authentication".
OpenID Certification does not cover this particular feature besides checking the presence of subject_types_supported (re #689).
Thank you in advance @arekkas!
Which version of the software is affected?
v1.0.0-beta.7 along with all the previous ones
The text was updated successfully, but these errors were encountered: