Example usage for org.springframework.security.oauth2.jwt Jwt getAudience

List of usage examples for org.springframework.security.oauth2.jwt Jwt getAudience

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.jwt Jwt getAudience.

Prototype

default List<String> getAudience() 

Source Link

Document

Returns the Audience (aud) claim which identifies the recipient(s) that the JWT is intended for.

Usage

From source file:org.springframework.cloud.gcp.security.iap.AudienceValidator.java

@Override
public OAuth2TokenValidatorResult validate(Jwt t) {
    if (t.getAudience() != null && t.getAudience().contains(this.audience)) {
        return OAuth2TokenValidatorResult.success();
    } else {/*w ww . ja va2s  .  com*/
        if (LOGGER.isWarnEnabled()) {
            LOGGER.warn(String.format("Expected audience %s did not match token audience %s", this.audience,
                    t.getAudience()));
        }
        return OAuth2TokenValidatorResult.failure(INVALID_AUDIENCE);
    }
}