Skip to content
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

Provide API Design guidelines for OAuth2 client credentials #171

Closed
AxelNennker opened this issue May 31, 2024 · 5 comments
Closed

Provide API Design guidelines for OAuth2 client credentials #171

AxelNennker opened this issue May 31, 2024 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@AxelNennker
Copy link
Collaborator

Problem description
There are Camara APIs that do not involve personal data and by specifying the openid-security-scheme in the API yaml file API consumers are missing important information. If no personal data is processed then an OAuth2 client credentials security scheme is what API consumers should find in the API yaml file.

There is currently no guideline for API designers how to specify OAuth2 client credentials.

The following are two Camara APIs that do not involve personal data:
https://github.com/camaraproject/PopulationDensityData/blob/main/code/API_definitions/population-density-data.yaml @jgarciahospital
https://github.com/camaraproject/QualityOnDemand/ especially https://github.com/camaraproject/QualityOnDemand/blob/main/code/API_definitions/qos-profiles.yaml @jlurien @eric-murray

Expected action
Provide a guideline for API designer on how to specify a security scheme that allows OAuth2 client credentials.

https://github.com/camaraproject/QualityOnDemand/blob/main/code/API_definitions/qos-profiles.yaml is currently using this security scheme

components:
  securitySchemes:
    oAuth2ClientCredentials:
      description: |
        The QoS Profiles API makes use of the OAUTH 2.0 client credentials grant which is applicable for server to server use cases involving trusted partners or clients without any protected user data involved. In this method the API invoker client is registered as a confidential client with an authorization grant type of client_credentials
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.example.com/oauth/token
          scopes: {}

Additional context

TSC agreed on October 19, 2023 :

Update OpenAPI security guideline (camaraproject/Commonalities#57)

Agreement to use openId connect discovery clause in the Open API Specification (OAS) and provided API scheme for the API in another form (either in seperate file or as documentation section within the OAS).
Documentation must also list possible security schema for the APIs.
[Action] Telefonica will propose a wording.
We need also to check how security schema are managed in 3GPP
Tanja De Groot provided following links: [3GPP 5G APIs](https://forge.3gpp.org/rep/all/5G_APIs), esp. [TS29122_CommonData.yaml](https://forge.3gpp.org/rep/all/5G_APIs/-/blob/REL-18/TS29122_CommonData.yaml)
Shilpa added the following specific link: [TS24558_Eees_EASDiscovery.yaml](https://forge.3gpp.org/rep/all/5G_APIs/-/blob/REL-18/TS24558_Eees_EASDiscovery.yaml)
Voting in Commonalities and ICM groups: as their decisions affect many other working groups, discussions needing a voting should be escalated to TSC.Update OpenAPI security guideline (https://github.com/camaraproject/Commonalities/pull/57)

Agreement to use openId connect discovery clause in the Open API Specification (OAS) and provided API scheme for the API in another form (either in seperate file or as documentation section within the OAS).
Documentation must also list possible security schema for the APIs.
[Action] Telefonica will propose a wording.
We need also to check how security schema are managed in 3GPP
Tanja De Groot provided following links: [3GPP 5G APIs](https://forge.3gpp.org/rep/all/5G_APIs), esp. [TS29122_CommonData.yaml](https://forge.3gpp.org/rep/all/5G_APIs/-/blob/REL-18/TS29122_CommonData.yaml)
Shilpa added the following specific link: [TS24558_Eees_EASDiscovery.yaml](https://forge.3gpp.org/rep/all/5G_APIs/-/blob/REL-18/TS24558_Eees_EASDiscovery.yaml)
Voting in Commonalities and ICM groups: as their decisions affect many other working groups, discussions needing a voting should be escalated to TSC.

PopulationDensityData was created in December 2023 after the TSC agreement.
QoS Profiles was split from QoS also after the TSC agreement.

I, @AxelNennker, think the TSC agreement should be re-visited because now we have Camara API that are client-credentials only.
There should be a guideline for API Designers in API Design guidelines how to specify oauth2 client-credentials in API yaml files.
API consumers would miss important information in the yaml files if the read the openid-security scheme in the API yaml file, but in fact the API requires client credentials.

@AxelNennker AxelNennker added the documentation Improvements or additions to documentation label May 31, 2024
@eric-murray
Copy link
Collaborator

There is an existing PR that will update the security scheme for the QoS Profiles YAML. This will use the openId scheme that is mandated by ICM, and the oAuth2ClientCredentials scheme deleted.

This scheme allows for the QoS Profiles endpoints to be called with either 3-legged or 2-legged access tokens - both are valid scenarios. The additional documentation that will be added to the OAS explains exactly how the API designer will find out the details of the applicable authorisation schemes, specifically:
Which specific authorization flows are to be used will be determined during onboarding process

So they will find out which authorisation flows are applicable via the Operate APIs, with the details (endpoint URLs, supported endpoint authentication methods, supported scopes, etc.) found via the openIdConnectUrl.

@AxelNennker
Copy link
Collaborator Author

I saw the PR but no documentation of the API behavior you describe in the above comment.
The yaml does not describe this behavior and that is where developers look.

Anyway, as long as there is one Camara API - population density - that is client credentials only, then there should be API designer guidelines on how that security scheme should be specified in the yaml.

@eric-murray
Copy link
Collaborator

The solution adopted by ICM was clear - developers (i.e. API consumers) will not know which authorisation schemes are applicable to an API until the onboarding stage. That is what is specified in the mandatory template to be included in each API. No more text is required, though anyone is free to propose additional documentation in the OAS itself.

The ICM "CAMARA API Access and User Consent Management" document already describes how client credentials are specified in the OAS. OIDC Discovery already allows additional grant types (such as client_credentials) to be specified in the openIdConnectUrl data.

@AxelNennker
Copy link
Collaborator Author

The solution adopted by ICM was clear - developers (i.e. API consumers) will not know which authorisation schemes are applicable to an API until the onboarding stage. That is what is specified in the mandatory template to be included in each API. No more text is required, though anyone is free to propose additional documentation in the OAS itself.

There are APIs that are client credentials only and I think their openapi yaml files should express that.
Therefore there should be an Camara guideline for oauth2 client credentials.
#172

@AxelNennker
Copy link
Collaborator Author

After DT-internal discussion closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants