Package net.oauth

Examples of net.oauth.OAuthException


                problem.setParameter("oauth_acceptable_signature_methods",
                        acceptable.toString());
            }
            throw problem;
        } catch (InstantiationException e) {
            throw new OAuthException(e);
        } catch (IllegalAccessException e) {
            throw new OAuthException(e);
        }
    }
View Full Code Here


                if (certObject != null) {
                    publicKey = loadPublicKey(certObject, true);
                }
            }
        } catch (GeneralSecurityException e) {
            throw new OAuthException(e);
        } catch (IOException e) {
            throw new OAuthException(e);
        }
    }
View Full Code Here

    protected String getSignature(String baseString) throws OAuthException {
        try {
            byte[] signature = sign(baseString.getBytes(OAuth.ENCODING));
            return base64Encode(signature);
        } catch (UnsupportedEncodingException e) {
            throw new OAuthException(e);
        } catch (GeneralSecurityException e) {
            throw new OAuthException(e);
        }
    }
View Full Code Here

            throws OAuthException {
        try {
            return verify(decodeBase64(signature),
                          baseString.getBytes(OAuth.ENCODING));
        } catch (UnsupportedEncodingException e) {
            throw new OAuthException(e);
        } catch (GeneralSecurityException e) {
            throw new OAuthException(e);
        }
    }
View Full Code Here

* verifiers
*/
public class MD5SequenceGenerator {
    public String generate(byte[] input) throws OAuthException {
        if (input == null) {
            throw new OAuthException("You have to pass input to Token Generator");
        }

        try {
            MessageDigest algorithm = MessageDigest.getInstance("MD5");
            algorithm.reset();
            algorithm.update(input);
            byte[] messageDigest = algorithm.digest();
            StringBuffer hexString = new StringBuffer();
            for (int i = 0; i < messageDigest.length; i++) {
                hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
            }

            return hexString.toString();
        } catch (NoSuchAlgorithmException e) {
            throw new OAuthException(e);
        }
    }
View Full Code Here

    String consumerKey = message.getConsumerKey();
    String signatureMethod = message.getSignatureMethod();
    OAuthConsumer consumer = keyManager.getOAuthConsumer(provider, consumerKey, signatureMethod);
    if (null == consumer) {
      logger.info("signed fetch verification failed: consumer is null");
      throw new OAuthException("Unauthorized");
    }
    OAuthAccessor accessor = new OAuthAccessor(consumer);
    message.validateMessage(accessor, validator);

    String viewerEmail = message.getParameter("opensocial_viewer_email");
    if (viewerEmail == null) {
      logger.info("signed fetch verification failed: viewer email is null");
      throw new OAuthException("Missing user identity opensocial_viewer_email");
    }

    // Retrieve and set the user info with the OAuth parameters
    Map<UserInfoProperties, Object> oauthParams = new HashMap<UserInfoProperties, Object>();
    oauthParams.put(UserInfoProperties.EMAIL, urlDecode(viewerEmail));
View Full Code Here

TOP

Related Classes of net.oauth.OAuthException

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.