Example usage for org.springframework.security.oauth2.core OAuth2TokenValidatorResult failure

List of usage examples for org.springframework.security.oauth2.core OAuth2TokenValidatorResult failure

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.core OAuth2TokenValidatorResult failure.

Prototype

public static OAuth2TokenValidatorResult failure(Collection<OAuth2Error> errors) 

Source Link

Document

Construct a failure OAuth2TokenValidatorResult with the provided detail

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 {//from  w w  w . java2 s .c  o  m
        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);
    }
}