Package com.sun.jersey.oauth.server.spi

Examples of com.sun.jersey.oauth.server.spi.OAuthConsumer


            if (rt == null) {
                // token invalid
                throw new OAuthException(Response.Status.BAD_REQUEST, null);
            }

            OAuthConsumer consumer = rt.getConsumer();
            if (consumer == null || !consKey.equals(consumer.getKey())) {
                // token invalid
                throw new OAuthException(Response.Status.BAD_REQUEST, null);

            }

            OAuthSecrets secrets = new OAuthSecrets().consumerSecret(consumer.getSecret()).tokenSecret(rt.getSecret());
            try {
                sigIsOk = OAuthSignature.verify(request, params, secrets);
            } catch (OAuthSignatureException ex) {
                Logger.getLogger(AccessTokenRequest.class.getName()).log(Level.SEVERE, null, ex);
            }
View Full Code Here


        // enforce other supported and required OAuth parameters
        requiredOAuthParam(params.getSignature());
        supportedOAuthParam(params.getVersion(), versions);

        // retrieve secret for consumer key
        OAuthConsumer consumer = provider.getConsumer(consumerKey);
        if (consumer == null) {
            throw newUnauthorizedException();
        }

        OAuthSecrets secrets = new OAuthSecrets().consumerSecret(consumer.getSecret());
        OAuthSecurityContext sc;
        String nonceKey;

        if (token == null) {
            if (consumer.getPrincipal() == null) {
                throw newUnauthorizedException();
            }
            nonceKey = "c:" + consumerKey;
            sc = new OAuthSecurityContext(consumer, request.isSecure());
        } else {
            OAuthToken accessToken = provider.getAccessToken(token);
            if (accessToken == null) {
                throw newUnauthorizedException();
            }

            OAuthConsumer atConsumer = accessToken.getConsumer();
            if (atConsumer == null || !consumerKey.equals(atConsumer.getKey())) {
                throw newUnauthorizedException();
            }

            nonceKey = "t:" + token;
            secrets.tokenSecret(accessToken.getSecret());
View Full Code Here

            String consKey = params.getConsumerKey();
            if (consKey == null) {
                throw new OAuthException(Response.Status.BAD_REQUEST, null);
            }

            OAuthConsumer consumer = provider.getConsumer(consKey);
            if (consumer == null) {
                throw new OAuthException(Response.Status.BAD_REQUEST, null);
            }
            OAuthSecrets secrets = new OAuthSecrets().consumerSecret(consumer.getSecret()).tokenSecret("");

            boolean sigIsOk = false;
            try {
                sigIsOk = OAuthSignature.verify(request, params, secrets);
            } catch (OAuthSignatureException ex) {
View Full Code Here

TOP

Related Classes of com.sun.jersey.oauth.server.spi.OAuthConsumer

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.