Package org.pac4j.oauth.client.exception

Examples of org.pac4j.oauth.client.exception.OAuthCredentialsException


            String stateParameter = context.getRequestParameter("state");
            logger.debug("sessionState : {} / stateParameter : {}", sessionState, stateParameter);
            if (stateParameter == null || !stateParameter.equals(sessionState)) {
                final String message = "Missing state parameter : session expired or possible threat of cross-site request forgery";
                logger.error(message);
                throw new OAuthCredentialsException(message);
            }
        }

        final String verifierParameter = context.getRequestParameter(OAUTH_CODE);
        if (verifierParameter != null) {
            final String verifier = OAuthEncoder.decode(verifierParameter);
            logger.debug("verifier : {}", verifier);
            return new OAuthCredentials(verifier, getName());
        } else {
            final String message = "No credential found";
            logger.error(message);
            throw new OAuthCredentialsException(message);
        }
    }
View Full Code Here


            logger.debug("token : {} / verifier : {}", token, verifier);
            return new OAuthCredentials(tokenSession, token, verifier, getName());
        } else {
            final String message = "No credential found";
            logger.error(message);
            throw new OAuthCredentialsException(message);
        }
    }
View Full Code Here

        logger.debug("token : {}", token);
        logger.debug("verifier : {}", verifier);
        if (tokenRequest == null) {
            final String message = "Token request expired";
            logger.error(message);
            throw new OAuthCredentialsException(message);
        }
        final String savedToken = tokenRequest.getToken();
        logger.debug("savedToken : {}", savedToken);
        if (savedToken == null || !savedToken.equals(token)) {
            final String message = "Token received : " + token + " is different from saved token : " + savedToken;
            logger.error(message);
            throw new OAuthCredentialsException(message);
        }
        final Verifier clientVerifier = new Verifier(verifier);
        final Token accessToken = this.service.getAccessToken(tokenRequest, clientVerifier);
        logger.debug("accessToken : {}", accessToken);
        return accessToken;
View Full Code Here

            return null;
        }
        // check errors
        try {
            boolean errorFound = false;
            final OAuthCredentialsException oauthCredentialsException = new OAuthCredentialsException(
                    "Failed to retrieve OAuth credentials, error parameters found");
            String errorMessage = "";
            for (final String key : OAuthCredentialsException.ERROR_NAMES) {
                final String value = context.getRequestParameter(key);
                if (value != null) {
                    errorFound = true;
                    errorMessage += key + " : '" + value + "'; ";
                    oauthCredentialsException.setErrorMessage(key, value);
                }
            }
            if (errorFound) {
                logger.error(errorMessage);
                throw oauthCredentialsException;
View Full Code Here

TOP

Related Classes of org.pac4j.oauth.client.exception.OAuthCredentialsException

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.