Example usage for org.springframework.boot.actuate.autoconfigure.cloudfoundry Token toString

List of usage examples for org.springframework.boot.actuate.autoconfigure.cloudfoundry Token toString

Introduction

In this page you can find the example usage for org.springframework.boot.actuate.autoconfigure.cloudfoundry Token toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundrySecurityInterceptor.java

private void check(HttpServletRequest request, String path) throws Exception {
    Token token = getToken(request);
    this.tokenValidator.validate(token);
    AccessLevel accessLevel = this.cloudFoundrySecurityService.getAccessLevel(token.toString(),
            this.applicationId);
    if (!accessLevel.isAccessAllowed(path)) {
        throw new CloudFoundryAuthorizationException(CloudFoundryAuthorizationException.Reason.ACCESS_DENIED,
                "Access denied");
    }/*from  ww  w .j a v  a 2 s .co m*/
    accessLevel.put(request);
}

From source file:org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive.CloudFoundrySecurityInterceptor.java

private Mono<Void> check(ServerWebExchange exchange, String path) {
    try {/*  w ww .jav  a  2s  . co m*/
        Token token = getToken(exchange.getRequest());
        return this.tokenValidator.validate(token)
                .then(this.cloudFoundrySecurityService.getAccessLevel(token.toString(), this.applicationId))
                .filter((accessLevel) -> accessLevel.isAccessAllowed(path))
                .switchIfEmpty(Mono
                        .error(new CloudFoundryAuthorizationException(Reason.ACCESS_DENIED, "Access denied")))
                .doOnSuccess(
                        (accessLevel) -> exchange.getAttributes().put("cloudFoundryAccessLevel", accessLevel))
                .then();
    } catch (CloudFoundryAuthorizationException ex) {
        return Mono.error(ex);
    }
}

From source file:org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet.CloudFoundrySecurityInterceptor.java

private void check(HttpServletRequest request, String endpointId) throws Exception {
    Token token = getToken(request);
    this.tokenValidator.validate(token);
    AccessLevel accessLevel = this.cloudFoundrySecurityService.getAccessLevel(token.toString(),
            this.applicationId);
    if (!accessLevel.isAccessAllowed(endpointId)) {
        throw new CloudFoundryAuthorizationException(Reason.ACCESS_DENIED, "Access denied");
    }//from  w ww  . j  ava  2 s .com
    request.setAttribute(AccessLevel.REQUEST_ATTRIBUTE, accessLevel);
}