Skip to content

Validate the aud claim in OAuth2 resource server #28427

@chenrujun

Description

@chenrujun

Background

According to this doc, resource-server must validate iss and aud.

Current situation

iss

  1. Congiguration: Now iss will be configured by spring.security.oauth2.resourceserver.jwt.issuer-uri,
  2. Validation logic:
    JwtDecoder jwtDecoderByJwkKeySetUri() {
    NimbusJwtDecoder nimbusJwtDecoder = NimbusJwtDecoder.withJwkSetUri(this.properties.getJwkSetUri())
    .jwsAlgorithm(SignatureAlgorithm.from(this.properties.getJwsAlgorithm())).build();
    String issuerUri = this.properties.getIssuerUri();
    if (issuerUri != null) {
    nimbusJwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuerUri));
    }
    return nimbusJwtDecoder;
    }

aud

No related logic

Requirement

Just like iss, we should validate aud. And add a property like spring.security.oauth2.resourceserver.jwt.audience.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions