Package org.apache.stratos.rest.endpoint.oauth2

Examples of org.apache.stratos.rest.endpoint.oauth2.ValidationServiceClient


    }

    public Response handle(Message message, ClassResourceInfo classResourceInfo) {
        try {
            OAuth2TokenValidationResponseDTO respDTO;
            ValidationServiceClient validationServiceClient = new
                    ValidationServiceClient(oauthValidationEndpoint, username, password);
            HttpHeaders httpHeaders = new HttpHeadersImpl(message);
            String header = httpHeaders.getRequestHeaders().getFirst("Authorization");
            // if the authorization token has Bearer..
            if (header.startsWith("Bearer ")) {
                String accessToken = header.substring(7).trim();
                respDTO = validationServiceClient.validateAuthenticationRequest(accessToken); //TODO : send scope params
                boolean valid = respDTO.getValid();
                if (!valid) {
                    // authorization failure..
                    return Response.status(Response.Status.FORBIDDEN).build();
                }
View Full Code Here

TOP

Related Classes of org.apache.stratos.rest.endpoint.oauth2.ValidationServiceClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.