001    package com.nimbusds.oauth2.sdk;
002    
003    
004    /**
005     * OAuth 2.0 authorisation and token endpoint errors.
006     *
007     * @author Vladimir Dzhuvinov
008     */
009    public final class OAuth2Error {
010    
011    
012            // Base OAuth 2.0 authorisation errors
013            
014            /**
015             * The request is missing a required parameter, includes an invalid 
016             * parameter code, or is otherwise malformed.
017             */
018            public static final ErrorObject INVALID_REQUEST = 
019                    new ErrorObject("invalid_request", "Invalid request");
020            
021            
022            /**
023             * The client is not authorised to request an authorisation code using 
024             * this method.
025             */
026            public static final ErrorObject UNAUTHORIZED_CLIENT =
027                    new ErrorObject("unauthorized_client", "Unauthorized client");
028            
029            
030            /**
031             * The resource owner or authorisation server denied the request.
032             */
033            public static final ErrorObject ACCESS_DENIED =
034                    new ErrorObject("access_denied", "Access denied by resource owner or authorization server");
035            
036            
037            /**
038             * The authorisation server does not support obtaining an authorisation 
039             * code using this method.
040             */
041            public static final ErrorObject UNSUPPORTED_RESPONSE_TYPE =
042                    new ErrorObject("unsupported_response_type", "Unsupported response type");
043            
044            
045            /**
046             * The requested scope is invalid, unknown, or malformed.
047             */
048            public static final ErrorObject INVALID_SCOPE =
049                    new ErrorObject("invalid_scope", "Invalid, unknown or malformed scope");
050            
051            
052            /**
053             * The authorisation server encountered an unexpected condition which 
054             * prevented it from fulfilling the request.
055             */
056            public static final ErrorObject SERVER_ERROR =
057                    new ErrorObject("server_error", "Unexpected server error");
058            
059            
060            /**
061             * The authorisation server is currently unable to handle the request 
062             * due to a temporary overloading or maintenance of the server.
063             */
064            public static final ErrorObject TEMPORARILY_UNAVAILABLE =
065                    new ErrorObject("temporarily_unavailable", "The authorization server is temporarily unavailable");
066            
067            
068            // Token, Base OAuth 2.0 authorisation errors, section 5.2
069            
070            /**
071             * Client authentication failed (e.g. unknown client, no client 
072             * authentication included, or unsupported authentication method).
073             */
074            public static final ErrorObject INVALID_CLIENT =
075                    new ErrorObject("invalid_client", "Client authentication failed");
076            
077            
078            /**
079             * The provided authorisation grant (e.g. authorisation code, resource 
080             * owner credentials) or refresh token is invalid, expired, revoked, 
081             * does not match the redirection URI used in the authorization request,
082             * or was issued to another client.
083             */
084            public static final ErrorObject INVALID_GRANT =
085                    new ErrorObject("invalid_grant", "Invalid grant");
086            
087            
088            /**
089             * The authorisation grant type is not supported by the authorisation 
090             * server.
091             */
092            public static final ErrorObject UNSUPPORTED_GRANT_TYPE =
093                    new ErrorObject("unsupported_grant_type", "Unsupported grant type");
094    
095            
096            /**
097             * Prevents public instantiation.
098             */
099            private OAuth2Error() { }
100    }