Package com.sun.jersey.oauth.signature

Examples of com.sun.jersey.oauth.signature.OAuthSecrets


        // create a new OAuth client filter passing the needed info as well as the AuthHandler
        OAuthClientFilter filter = new OAuthClientFilter(
                client.getProviders(),
                new OAuthParameters().consumerKey(PROPERTIES.getProperty(PROPERTY_CONSUMER_KEY))
                    .token(PROPERTIES.getProperty(PROPERTY_TOKEN)),
                new OAuthSecrets().consumerSecret(PROPERTIES.getProperty(PROPERTY_CONSUMER_SECRET))
                    .tokenSecret(PROPERTIES.getProperty(PROPERTY_TOKEN_SECRET)),
                "http://twitter.com/oauth/request_token",
                "http://twitter.com/oauth/access_token",
                "http://twitter.com/oauth/authorize",
                authHandler);
View Full Code Here


        OAuthParameters params = new OAuthParameters()
          .signatureMethod(oAuthSignatureMethod)
          .consumerKey(oAuthConsumerKey)
          .version("1.1");

        OAuthSecrets secrets = new OAuthSecrets()
          .consumerSecret(oAuthConsumerSecret);
        OAuthClientFilter filter = new OAuthClientFilter(c.getProviders(), params, secrets);
        setClient(c);
        wr = c.resource(uri);
        wr.addFilter(filter);
View Full Code Here

                // 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

            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

        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());
            sc = new OAuthSecurityContext(accessToken, request.isSecure());
        }

        if (!verifySignature(osr, params, secrets)) {
            throw newUnauthorizedException();
View Full Code Here

    this.accessToken = accessToken;
    this.accessSecret = accessSecret;
    if (accessToken != null && accessSecret != null){
      OAuthParameters params = new OAuthParameters().consumerKey(CONSUMER_KEY)
        .signatureMethod("HMAC-SHA1").version("1.1").token(accessToken);
      OAuthSecrets secrets = new OAuthSecrets().consumerSecret(CONSUMER_SECRET)
        .tokenSecret(accessSecret);
      oAuthFilter = new OAuthClientFilter(client.getProviders(), params, secrets);
      service.addFilter(oAuthFilter);
      accessIsSet = true;     
    } else {
View Full Code Here

TOP

Related Classes of com.sun.jersey.oauth.signature.OAuthSecrets

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.