Package org.jboss.resteasy.auth.oauth

Examples of org.jboss.resteasy.auth.oauth.OAuthException


            update("UPDATE request_tokens SET verifier='" + verifier + "' "
                    + "WHERE token='" + requestToken + "'");
        
            return verifier;
         } catch (SQLException ex) {
             throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED,
                     "Request token for the consumer with key " + consumerKey + " can not be authorized");
         }
    }
View Full Code Here


                String scopes = rs.getString("scopes");
                String permissions = rs.getString("permissions");
                String tokenConsumerKey = rs.getString("consumer_key");
               
                if (consumerKey != null && !tokenConsumerKey.equals(consumerKey)) {
                    throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
                }
               
                return new OAuthToken(token, secret,
                        scopes == null ? null : new String[] {scopes},
                        permissions == null ? null : new String[] {permissions},       
                        -1, getConsumer(tokenConsumerKey));
            } else {
                throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
            }
        } catch (SQLException ex) {
            throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
        }
    }
View Full Code Here

                    new OAuthConsumer(key, secret, displayName, connectURI,
                        perms != null ? new String[]{perms} : null);
                consumer.setScopes(new String[]{scopes});
                return consumer;
            } else {
                throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
            }
        } catch (SQLException ex) {
            throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
        }
    }
View Full Code Here

                String permissions = rs.getString("permissions");
                String verifier = rs.getString("verifier");
                String tokenConsumerKey = rs.getString("consumer_key");
               
                if (consumerKey != null && !tokenConsumerKey.equals(consumerKey)) {
                    throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
                }
               
                OAuthRequestToken newToken = new OAuthRequestToken(token, secret, callback,
                        scopes == null ? null : new String[] {scopes},
                        permissions == null ? null : new String[] {permissions},       
                        -1, getConsumer(tokenConsumerKey));
                newToken.setVerifier(verifier);
                return newToken;
            } else {
                throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
            }
        } catch (SQLException ex) {
            throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "No such consumer key "+consumerKey);
        }
    }
View Full Code Here

                    + ")");
        
            return new OAuthToken(token, secret,
                    requestToken.getScopes(), requestToken.getPermissions(), -1, requestToken.getConsumer());
         } catch (SQLException ex) {
             throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED,
                     "Request token for the consumer with key " + consumerKey + " can not be created");
         }
    }
View Full Code Here

    private OAuthRequestToken verifyAndRemoveRequestToken(String consumerKey, String requestToken, String verifier) throws OAuthException {
        OAuthRequestToken token = getRequestToken(consumerKey, requestToken);
        checkCustomerKey(token, consumerKey);
        // check the verifier, which is only set when the request token was accepted
        if(verifier == null || !verifier.equals(token.getVerifier()))
            throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "Invalid verifier code for token "+requestToken);
        try
        {
            update("DELETE FROM request_tokens WHERE token='" + requestToken + "'");
        }
        catch (SQLException ex)
View Full Code Here

                    + ")");
        
            return new OAuthRequestToken(token, secret, callback,
                    scopes, permissions, -1, getConsumer(consumerKey));
         } catch (SQLException ex) {
             throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED,
                     "Request token for the consumer with key " + consumerKey + " can not be created");
         }
        
    }
View Full Code Here

                       + ", " + (displayName == null ? null : "'" + displayName + "'")
                       + ", " + (connectURI == null ? null : "'" + connectURI + "'")
                       + ")");
           
        } catch (SQLException ex) {
            throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED,
                    "Consumer with key " + consumerKey + " can not be created");
        }
        return new OAuthConsumer(consumerKey, secret, displayName, connectURI);
    }
View Full Code Here

        return UUID.randomUUID().toString();
    }

    private void checkCustomerKey(OAuthToken token, String customerKey) throws OAuthException {
        if (customerKey != null && !customerKey.equals(token.getConsumer().getKey())) {
            throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED, "Invalid customer key");
        }
    }
View Full Code Here

                update("UPDATE consumers SET scopes="
                        + "'" + scopes[0] + "'"
                        + " WHERE key='" + consumerKey + "'");
            }
         } catch (SQLException ex) {
             throw new OAuthException(HttpURLConnection.HTTP_UNAUTHORIZED,
                     "Scopes for the consumer with key " + consumerKey + " can not be registered");
         }

    }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.auth.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.