org.springframework.security.oauth2.common.exceptions
Class OAuth2Exception

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.springframework.security.oauth2.common.exceptions.OAuth2Exception
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClientAuthenticationException, InsufficientScopeException, InvalidScopeException, OAuth2AccessDeniedException, UnsupportedGrantTypeException, UnsupportedResponseTypeException, UserDeniedAuthorizationException

public class OAuth2Exception
extends RuntimeException

Base exception for OAuth 2 exceptions.

Author:
Ryan Heaton, Rob Winch, Dave Syer
See Also:
Serialized Form

Field Summary
static String ACCESS_DENIED
           
static String DESCRIPTION
           
static String ERROR
           
static String INVALID_CLIENT
           
static String INVALID_GRANT
           
static String INVALID_REQUEST
           
static String INVALID_SCOPE
           
static String INVALID_TOKEN
           
static String REDIRECT_URI_MISMATCH
           
static String UNAUTHORIZED_CLIENT
           
static String UNSUPPORTED_GRANT_TYPE
           
static String UNSUPPORTED_RESPONSE_TYPE
           
static String URI
           
 
Constructor Summary
OAuth2Exception(String msg)
           
OAuth2Exception(String msg, Throwable t)
           
 
Method Summary
 void addAdditionalInformation(String key, String value)
          Add some additional information with this OAuth error.
static OAuth2Exception create(String errorCode, String errorMessage)
          Creates the appropriate subclass of OAuth2Exception given the errorCode.
 Map<String,String> getAdditionalInformation()
          Get any additional information associated with this error.
 int getHttpErrorCode()
          The HTTP error code associated with this error.
 String getOAuth2ErrorCode()
          The OAuth2 error code.
 String getSummary()
           
 String toString()
           
static OAuth2Exception valueOf(Map<String,String> errorParams)
          Creates an OAuth2Exception from a Map.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR

public static final String ERROR
See Also:
Constant Field Values

DESCRIPTION

public static final String DESCRIPTION
See Also:
Constant Field Values

URI

public static final String URI
See Also:
Constant Field Values

INVALID_REQUEST

public static final String INVALID_REQUEST
See Also:
Constant Field Values

INVALID_CLIENT

public static final String INVALID_CLIENT
See Also:
Constant Field Values

INVALID_GRANT

public static final String INVALID_GRANT
See Also:
Constant Field Values

UNAUTHORIZED_CLIENT

public static final String UNAUTHORIZED_CLIENT
See Also:
Constant Field Values

UNSUPPORTED_GRANT_TYPE

public static final String UNSUPPORTED_GRANT_TYPE
See Also:
Constant Field Values

INVALID_SCOPE

public static final String INVALID_SCOPE
See Also:
Constant Field Values

INVALID_TOKEN

public static final String INVALID_TOKEN
See Also:
Constant Field Values

REDIRECT_URI_MISMATCH

public static final String REDIRECT_URI_MISMATCH
See Also:
Constant Field Values

UNSUPPORTED_RESPONSE_TYPE

public static final String UNSUPPORTED_RESPONSE_TYPE
See Also:
Constant Field Values

ACCESS_DENIED

public static final String ACCESS_DENIED
See Also:
Constant Field Values
Constructor Detail

OAuth2Exception

public OAuth2Exception(String msg,
                       Throwable t)

OAuth2Exception

public OAuth2Exception(String msg)
Method Detail

getOAuth2ErrorCode

public String getOAuth2ErrorCode()
The OAuth2 error code.

Returns:
The OAuth2 error code.

getHttpErrorCode

public int getHttpErrorCode()
The HTTP error code associated with this error.

Returns:
The HTTP error code associated with this error.

getAdditionalInformation

public Map<String,String> getAdditionalInformation()
Get any additional information associated with this error.

Returns:
Additional information, or null if none.

addAdditionalInformation

public void addAdditionalInformation(String key,
                                     String value)
Add some additional information with this OAuth error.

Parameters:
key - The key.
value - The value.

create

public static OAuth2Exception create(String errorCode,
                                     String errorMessage)
Creates the appropriate subclass of OAuth2Exception given the errorCode.

Parameters:
errorCode -
errorMessage -
Returns:

valueOf

public static OAuth2Exception valueOf(Map<String,String> errorParams)
Creates an OAuth2Exception from a Map.

Parameters:
errorParams -
Returns:

toString

public String toString()
Overrides:
toString in class Throwable

getSummary

public String getSummary()
Returns:
a comma-delimited list of details (key=value pairs)


Copyright © 2012. All Rights Reserved.