-
Notifications
You must be signed in to change notification settings - Fork 79
Add descriptions and examples of common API authentication scenarios #126
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
Comments
This is great, and I think there are a lot of people who can share their experiences to help us here! Could everyone please add a comment? We need to know:
|
Can this be moved to a discussion, so it's possible to respond in a thready fashion to each individual post? |
Good suggestion @karenetheridge. I don't see an option to do that, but maybe I just don't have permissions? |
We don't currently use discussions on this repo and I'm not sure we have the volunteer bandwidth to monitor another forum. I suggest if there's anything we want to get into in more detail, we create an issue for that thing and maintain a list in the description. @SensibleWood I'm particularly looking for examples to include in the documentation of things that do work. Please share snippets if you have them. |
@lornajane sorry that wasn't clear from what @mikekistler originally asked. I've removed my comments. |
Ah! That's not at all what I intended, @SensibleWood - your examples are good and valuable, and since we'll need to find or create supporting OpenAPI examples for each of the entries we can come up with then yours would have given us a great start if you had them! The goal is to list the things that are supported, with examples, and identify what isn't easy to express with a view to updating the specification in a future release to accommodate more options. |
@SensibleWood Yes these were definitely valuable and I'm sorry I have been slow to add my own. |
Here's a very common scenario in apps that use the ASP.NET web application framework:
Here I have not really covered the details of how authentication is done at the challenge endpoint -- there are many various options there, including username/password, two-factor / multi-factor auth, passkeys, proof of possession, etc. For the endpoints that just require the cookie, the only way to describe this in OpenAPI (as best I could determine), is: securitySchemes:
cookieAuth:
type: apiKey
in: cookie
name: session_id # Name of the cookie used for authentication This feels woefully inadequate at expressing the actual auth mechanism described above. |
@lornajane @mikekistler Reposted for posterity - not supported, but wouldn't they be nice? Surely SAML? I don't use it in API design as I am OAuth/OIDC in nature, but I see so many (enterprise) APIs in action that do it. Based on your bullets @lornajane: SAML
This guy: https://datatracker.ietf.org/doc/rfc7523/ (JSON Web Token (JWT) Profile) It's a relatively straightforward proof-of-possession authentication mechanism used in open banking standards, but has specific semantics that require a specific description over above "just" describing a JWT. JSON Web Token (JWT) Profile
This guy: https://datatracker.ietf.org/doc/html/rfc9449 (Demonstrating proof-of-possession) Takes the JWT Profile about and add a standardised header to indicate consistency between token request and resource server in OAuth/OIDC flows.
|
There are a number of common approaches for authenticating/authorizing requests to an API. The OpenAPI securitySchemes and security requirements are intended to document the authn/authz requirements of operations in an API description. I think we should develop practical guidance for how the common authn/authz mechanisms should be or can be described in OpenAPI documents.
Some of the common approaches that should be described are:
The text was updated successfully, but these errors were encountered: