Repository navigation
Core: Add OAuth2 to REST catalog spec - #4771
Conversation
| default: "" | ||
| # All routes are currently configured using an Authorization header. | ||
| security: | ||
| - OAuth2: [catalog] |
There was a problem hiding this comment.
I added just one scope for all catalog and config access. Alternatively, we could separate this into read and read/modify scopes to allow read-only access.
There was a problem hiding this comment.
+1. I think the one scope is fine for now.
| type: string | ||
| enum: | ||
| - client_credentials | ||
| - urn:ietf:params:oauth:grant-type:token-exchange |
There was a problem hiding this comment.
Should we consider giving the prefix urn:ietf:params:oauth: special status, like via a reusable component? Maybe a schema element?
It can be used with token-type, grant-type, and many other things.
Maybe it could be a prefix in an OAuthParams schema object that has various? various possible enums in it. Mostly thinking out loud.
There was a problem hiding this comment.
Splitting it would make this more confusing, I think. There's not a lot to reuse here besides a prefix.
| ############################# | ||
| responses: | ||
|
|
||
| OAuthTokenResponse: |
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
| ############################# | ||
| responses: | ||
|
|
||
| OAuthTokenResponse: |
There was a problem hiding this comment.
This doesn't quite match the spec for granting a token (it looks like it matches the token exchange response though)
There was a problem hiding this comment.
It's a superset of the fields in section 5.1 so that we can use it for both the client credentials and token exchange flows.
I just double-checked and it looks like the main problem is that issued_token_type is marked as required, even though it won't be present for client credentials. Is that what you were referring to? I'll make sure that only the fields that are required in both are actually required here. I'll also update each of these with a description so it is clear when they can or should be set.
Do you know when token_type and issued_token_type would both be used for token exchange? issued_token_type makes sense to me, but I'm not sure why token_type wouldn't simply be the one that was issued.
There was a problem hiding this comment.
Yeah, that's what I meant, that the required fields for the grant token response are only access_token and token_type in the spec. For token exchange, issued_token_type is also required. For token exchange, the token_type is referring to the HTTP Authorization token type, e.g. most of the time set to bearer, and the issued_token_type is the OAuth token type. Also, expires_in is recommended but optional (for both).
There was a problem hiding this comment.
Thanks for the clarification! I just assumed issued_token_type was the same thing as token_type, but that makes sense.
|
I ran a few openapi validators over this and the output seems ok: |
This adds an additional security scheme to the REST catalog spec for OAuth2, following the OpenAPI 3 instructions.
This also adds the
v1/oauth/tokenroute that describes the client credentials or token exchange flows.