-
Notifications
You must be signed in to change notification settings - Fork 26
Token Exchange support #162
Comments
The way I see it a token exchange request is an exchange between a token with a set of token_type/scope/resource/audience to a different token with another set of token_type/scope/resource/audience. The task of the library is to :
I see 2 big problems with this:
For (1):
For (2):
Other than that we should add a set of validations based on the
@rohe @peppelinux any thoughts on this approach? |
Hi, happy to see this PR indeed @nsklikas on your thoughts
1.1 I'd store only the event of exchange, at STS side, as a log. Yes, the revocation of the parent won't revocke the children |
@nsklikas My 2c
|
@peppelinux But wouldn't that be like using a refresh token? I understand your doubts about sharing tokens between clients, but I think that sometimes it is okay. If the user has given his consent, giving an access token to a trusted client may be okay (although I still don't like this approach). Perhaps this should be configurable as well.
@rohe Sure, I agree if the token comes from the same client it should be revoked as well. |
@peppelinux something went wrong and you edited my comment instead of writing an answer. I will paste it here for now:
|
No but issuing a refresh token requires the user 's consent, likewise giving an access token to another client and exchanging it for a refresh token must have the consent of the user Also it's not clear to me what an STS is, is there some oauth2 spec describing it? |
STS is here what's the specs you're considering for this token endpoint? |
Ok, I'm blind. Thanks.
You mean that the RS should expose an STS endpoint? I'm not really sure what you mean. |
The STS is only an endpoint, it can be hosted anywhere |
In #165 Token Exchange support is introduced based on the discussion here. I'm considering the following format for the token exchange related configurations. "token": {
"path": "token",
"class": "oidcop.oidc.token.Token",
"kwargs": {
"token_exchange": {
"subject_token_types_supported": [
"urn:ietf:params:oauth:token-type:access_token",
"urn:ietf:params:oauth:token-type:refresh_token",
"urn:ietf:params:oauth:token-type:id_token"
],
"requested_token_types_supported": [
"urn:ietf:params:oauth:token-type:access_token",
"urn:ietf:params:oauth:token-type:refresh_token",
"urn:ietf:params:oauth:token-type:id_token"
],
"policy": {
"urn:ietf:params:oauth:token-type:refresh_token": {
"callable": "/path/to/callable",
"kwargs": {
"audience": ["https://example.com"],
"resource": [],
"scopes": ["abc", "def"],
}
},
"": {
"callable": "/path/to/callable",
"kwargs": {
"audience": ["https://example.com"],
"resource": [],
"scopes": ["abc", "def"],
"requested_token_types_supported": [
"urn:ietf:params:oauth:token-type:access_token",
"urn:ietf:params:oauth:token-type:refresh_token",
"urn:ietf:params:oauth:token-type:id_token"
],
}
}
}
}
}, Any configuration under the Under the Any comments? |
So it will be {
"token": {
"path": "token",
"class": "oidcop.oidc.token.Token",
"kwargs": {
"token_exchange": {
"subject_token_types_supported": [] # A list of supported subject_token_types, if not defined then all token_types are allowed
"requested_token_types_supported": [] # A list of supported requested_token_types, if not defined then all token_types are allowed
"policy": {
"token_type": # If {token_type} is not in subject_token_types_supported, then this is ignored
"token_type_2": {
"callable": # A string path to a callable or a callable object
"kwargs": # A dict with extra params that will be passed to the callable in addition to request, token, context, etc
"": {} # The default policy which we will fall back to in case a token_type is supported, but not defined in the policy dict
} |
So, we are in the process of adding Token Exchange support on oidc-op as described in RFC-8693 and we need feedback regarding the implementation.
More specifically, we consider the following scenario regarding the exchanging of Access Tokens with Refresh Tokens:
USER_A
accessesCLIENT_A
and retrieves an Access TokenAT1
with a set of scopes that includes theoffline_scope
.CLIENT_A
sendsAT1
toCLIENT_B
.CLIENT_B
exchangesAT1
with a new Refresh TokenRT1
with the same scope set, but sets theaudience
parameter of the request to beCLIENT_C
andCLIENT_D
.CLIENT_B
,CLIENT_C
orCLIENT_D
may useRT1
to get Access TokenAT2
with the same or fewer scopes (and optionally with a different audience) to access protected resource X. Equivalently,AT2
will be owned by the client that issued the new Token Exchange request and every client (if any) that will be stated in the audience parameter will be allowed to use it.Some observations on the aforementioned scenario:
AT1
belongs to a sessionUSER_A;;CLIENT_A
in terms of oidc-op.RT1
should be mapped in a different client in order forCLIENT_B
to be able to use it. This in terms of oidc-op is interpreted as a new sessionUSER_A;;CLIENT_B
where the token should be assigned.RT1
are allowed to use it. Currently, oidc-op retrieves the session thatRT1
is mapped to and checks if theclient_id
stated in the request matches the client of the session. This check should be modified in order to include a check upon theaudience
of the used token.audience
(or evenresource
) parameter should represent. For now, we intend to map theaudience
parameter with oidc-opclient_id
.Some potential conflicts in case of multiple audiences:
The text was updated successfully, but these errors were encountered: