View Javadoc

1   /**
2    *       Copyright 2010 Newcastle University
3    *
4    *          http://research.ncl.ac.uk/smart/
5    *
6    * Licensed to the Apache Software Foundation (ASF) under one or more
7    * contributor license agreements.  See the NOTICE file distributed with
8    * this work for additional information regarding copyright ownership.
9    * The ASF licenses this file to You under the Apache License, Version 2.0
10   * (the "License"); you may not use this file except in compliance with
11   * the License.  You may obtain a copy of the License at
12   *
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   */
21  
22  package org.apache.amber.oauth2.common.error;
23  
24  /**
25   *
26   *
27   *
28   */
29  public abstract class OAuthError {
30  
31      //error response params
32      public static final String OAUTH_ERROR = "error";
33      public static final String OAUTH_ERROR_DESCRIPTION = "error_description";
34      public static final String OAUTH_ERROR_URI = "error_uri";
35  
36      public static final class CodeResponse {
37          /**
38           * The request is missing a required parameter, includes an
39          unsupported parameter value, or is otherwise malformed.
40           */
41          public static final String INVALID_REQUEST = "invalid_request";
42          
43          /**
44           * The client is not authorized to request an authorization
45          code using this method.
46           */
47          public static final String UNAUTHORIZED_CLIENT = "unauthorized_client";
48  
49          /**
50           * The resource owner or authorization server denied the
51          request.
52           */
53          public static final String ACCESS_DENIED = "access_denied";
54  
55          /**
56           * The authorization server does not support obtaining an
57          authorization code using this method.
58           */
59          public static final String UNSUPPORTED_RESPONSE_TYPE = "unsupported_response_type";
60  
61          /**
62           * The requested scope is invalid, unknown, or malformed.
63           */
64          public static final String INVALID_SCOPE = "invalid_scope";
65  
66          /**
67           * The authorization server encountered an unexpected
68          condition which prevented it from fulfilling the request.
69           */
70          public static final String SERVER_ERROR = "server_error";
71  
72          /**
73           *         The authorization server is currently unable to handle
74          the request due to a temporary overloading or maintenance
75          of the server.
76           */
77          public static final String TEMPORARILY_UNAVAILABLE = "temporarily_unavailable";
78  
79      }
80  
81      public static final class TokenResponse {
82          /**
83          The request is missing a required parameter, includes an
84          unsupported parameter value, repeats a parameter,
85          includes multiple credentials, utilizes more than one
86          mechanism for authenticating the client, or is otherwise
87          malformed.
88          */
89          public static final String INVALID_REQUEST = "invalid_request";
90          /**
91          Client authentication failed (e.g. unknown client, no
92          client authentication included, or unsupported
93          authentication method).  The authorization server MAY
94          return an HTTP 401 (Unauthorized) status code to indicate
95          which HTTP authentication schemes are supported.  If the
96          client attempted to authenticate via the "Authorization"
97          request header field, the authorization server MUST
98          respond with an HTTP 401 (Unauthorized) status code, and
99          include the "WWW-Authenticate" response header field
100         matching the authentication scheme used by the client.
101         */
102         public static final String INVALID_CLIENT = "invalid_client";
103 
104         /**
105         The provided authorization grant (e.g. authorization
106         code, resource owner credentials, client credentials) is
107         invalid, expired, revoked, does not match the redirection
108         URI used in the authorization request, or was issued to
109         another client.
110         */
111         public static final String INVALID_GRANT = "invalid_grant";
112 
113         /**
114         The authenticated client is not authorized to use this
115         authorization grant type.
116         */
117         public static final String UNAUTHORIZED_CLIENT = "unauthorized_client";
118 
119         /**
120         The authorization grant type is not supported by the
121         authorization server.
122         */
123         public static final String UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type";
124 
125         /**
126          * The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner.
127          */
128         public static final String INVALID_SCOPE = "invalid_scope";
129     }
130 
131     public static final class ResourceResponse {
132     	/**
133         The request is missing a required parameter, includes an
134         unsupported parameter value, repeats a parameter,
135         includes multiple credentials, utilizes more than one
136         mechanism for authenticating the client, or is otherwise
137         malformed.
138         */
139         public static final String INVALID_REQUEST = "invalid_request";
140         
141         
142         public static final String EXPIRED_TOKEN = "expired_token";
143         
144         /**
145          * The request requires higher privileges than provided by the
146          * access token.
147          */
148         public static final String INSUFFICIENT_SCOPE = "insufficient_scope";
149         
150         /**
151          * The access token provided is expired, revoked, malformed, or
152          * invalid for other reasons.
153          */
154         public static final String INVALID_TOKEN = "invalid_token";
155     }
156 
157 }