Package org.gatein.security.oauth.exception

Examples of org.gatein.security.oauth.exception.OAuthException


        }
    }

    @Override
    public InteractionState<TwitterAccessTokenContext> processOAuthInteraction(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String scope) throws IOException, OAuthException {
        throw new OAuthException(OAuthExceptionCode.TWITTER_ERROR, "This is currently not supported for Twitter");
    }
View Full Code Here


            Twitter twitter = getAuthorizedTwitterInstance(accessToken);
            twitter.verifyCredentials();
            return accessToken;
        } catch (TwitterException tw) {
            if (tw.getStatusCode() == 401) {
                throw new OAuthException(OAuthExceptionCode.ACCESS_TOKEN_ERROR,
                        "Error when verifying twitter access token: " + tw.getMessage(), tw);
            } else {
                throw new OAuthException(OAuthExceptionCode.IO_ERROR,
                        "IO Error when obtaining tokenInfo: " + tw.getClass() + ": " + tw.getMessage(), tw);
            }
        }
    }
View Full Code Here

        User twitterUser;
        try {
            twitterUser = twitter.verifyCredentials();
        } catch (TwitterException te) {
            throw new OAuthException(OAuthExceptionCode.TWITTER_ERROR, "Error when obtaining user", te);
        }

        OAuthPrincipal<TwitterAccessTokenContext> oauthPrincipal = OAuthUtils.convertTwitterUserToOAuthPrincipal(twitterUser,
                accessTokenContext, getOAuthProvider());
        return oauthPrincipal;
View Full Code Here

            return (User)m.invoke(userHandler, oauthProviderType.getUserNameAttrName(), oauthProviderUsername);
        } catch (NoSuchMethodException e) {
            String error = "Method findUserByUniqueAttribute(String, String) is not available on userHandler object " + userHandler +
                    "of class " + userHandler.getClass();
            log.error(error);
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, error, e);
        } catch (Exception e) {
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, e);
        }
    }
View Full Code Here

            userProfileHandler.saveUserProfile(userProfile, true);
        } catch (OAuthException oauthEx) {
            throw oauthEx;
        } catch (Exception e) {
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, e);
        }
    }
View Full Code Here

            UserProfile userProfile = userProfileHandler.findUserProfileByName(username);

            OAuthProviderProcessor<T> oauthProviderProcessor = oauthProviderType.getOauthProviderProcessor();
            return oauthProviderProcessor.getAccessTokenFromUserProfile(userProfile, this);
        } catch (Exception e) {
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, e);
        }
    }
View Full Code Here

            OAuthProviderProcessor<T> oauthProviderProcessor = oauthProviderType.getOauthProviderProcessor();
            oauthProviderProcessor.removeAccessTokenFromUserProfile(userProfile);

            userProfileHandler.saveUserProfile(userProfile, true);
        } catch (Exception e) {
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, e);
        }
    }
View Full Code Here

            oauthProviderProcessor.saveAccessTokenAttributesToUserProfile(userProfile, this, accessToken);
            userProfileHandler.saveUserProfile(userProfile, true);
        } catch (OAuthException oauthEx) {
            throw oauthEx;
        } catch (Exception e) {
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, e);
        }
    }
View Full Code Here

            } else {
                String verifier = request.getParameter(OAuthConstants.OAUTH_VERIFIER);

                // User denied scope
                if (request.getParameter(OAuthConstants.OAUTH_DENIED) != null) {
                    throw new OAuthException(OAuthExceptionCode.USER_DENIED_SCOPE, "User denied scope on Twitter authorization page");
                }

                // Obtain accessToken from twitter
                AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier);

                if (log.isTraceEnabled()) {
                    log.trace("Twitter accessToken: " + accessToken);
                }

                // Remove requestToken from session. We don't need it anymore
                session.removeAttribute(OAuthConstants.ATTRIBUTE_TWITTER_REQUEST_TOKEN);
                TwitterAccessTokenContext accessTokenContext = new TwitterAccessTokenContext(accessToken.getToken(), accessToken.getTokenSecret());

                return new InteractionState<TwitterAccessTokenContext>(InteractionState.State.FINISH, accessTokenContext);
            }
        } catch (TwitterException twitterException) {
            throw new OAuthException(OAuthExceptionCode.TWITTER_ERROR, twitterException);
        }
    }
View Full Code Here

        }
    }

    @Override
    public InteractionState<TwitterAccessTokenContext> processOAuthInteraction(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String scope) throws IOException, OAuthException {
        throw new OAuthException(OAuthExceptionCode.TWITTER_ERROR, "This is currently not supported for Twitter");
    }
View Full Code Here

TOP

Related Classes of org.gatein.security.oauth.exception.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.