Skip to content

Adding 'audience' to ClientRegistration for OAuth2.0 client-credentials flow #7379

Closed
@j-chao

Description

@j-chao

Summary

There doesn't seem to be a way to specify the audience/resource server for a token request to an authorization server via client-credentials grant-type flow.

Actual Behavior

There is no way obvious way to define the audience of the token, when requesting for a token.

Expected Behavior

There should be a way to specify an 'aud' with the creation of the ClientRegistration object.

Configuration

Spring Boot 2.2.0.M4 project
Java 12
maven

Version

Spring Security 5.2.0.M3

Sample

The payload of the jwt token that is returned should contain the audience as specified in the request. ie:

Request:

curl -X POST \
  https://login.microsoftonline.com/31f52c3f-25dd-415f-b9b9-36a2e0391777/oauth2/token \
  -d 'grant_type=client_credentials&client_id=<my_client_id>&client_secret=<my_client_secret>&resource=https%3A%2F%2Fmy-resource.com'

Payload of returned JWT token:

{
  "aud": "https://my-resource.com",
  "iss": "https://sts.windows.net/31f52c3f-25dd-415f-b9b9-36a2e0391777/",
  "iat": 1567705779,
  "nbf": 1567705779,
  "exp": 1567709679,
  ...
}

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions