summaryrefslogtreecommitdiff
path: root/oauthlib/oauth2/rfc6749
diff options
context:
space:
mode:
Diffstat (limited to 'oauthlib/oauth2/rfc6749')
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/authorization_code.py27
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/base.py3
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/client_credentials.py3
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/implicit.py27
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/refresh_token.py3
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py3
6 files changed, 22 insertions, 44 deletions
diff --git a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
index 05273e7..b6ff07c 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
@@ -267,12 +267,10 @@ class AuthorizationCodeGrant(GrantTypeBase):
# REQUIRED. The client identifier as described in Section 2.2.
# http://tools.ietf.org/html/rfc6749#section-2.2
if not request.client_id:
- raise errors.MissingClientIdError(
- state=request.state, request=request)
+ raise errors.MissingClientIdError(request=request)
if not self.request_validator.validate_client_id(request.client_id, request):
- raise errors.InvalidClientIdError(
- state=request.state, request=request)
+ raise errors.InvalidClientIdError(request=request)
# OPTIONAL. As described in Section 3.1.2.
# http://tools.ietf.org/html/rfc6749#section-3.1.2
@@ -282,21 +280,18 @@ class AuthorizationCodeGrant(GrantTypeBase):
request.using_default_redirect_uri = False
log.debug('Using provided redirect_uri %s', request.redirect_uri)
if not is_absolute_uri(request.redirect_uri):
- raise errors.InvalidRedirectURIError(
- state=request.state, request=request)
+ raise errors.InvalidRedirectURIError(request=request)
if not self.request_validator.validate_redirect_uri(
request.client_id, request.redirect_uri, request):
- raise errors.MismatchingRedirectURIError(
- state=request.state, request=request)
+ raise errors.MismatchingRedirectURIError(request=request)
else:
request.redirect_uri = self.request_validator.get_default_redirect_uri(
request.client_id, request)
request.using_default_redirect_uri = True
log.debug('Using default redirect_uri %s.', request.redirect_uri)
if not request.redirect_uri:
- raise errors.MissingRedirectURIError(
- state=request.state, request=request)
+ raise errors.MissingRedirectURIError(request=request)
# Then check for normal errors.
@@ -310,13 +305,11 @@ class AuthorizationCodeGrant(GrantTypeBase):
# Note that the correct parameters to be added are automatically
# populated through the use of specific exceptions.
if request.response_type is None:
- raise errors.InvalidRequestError(state=request.state,
- description='Missing response_type parameter.', request=request)
+ raise errors.InvalidRequestError(description='Missing response_type parameter.', request=request)
for param in ('client_id', 'response_type', 'redirect_uri', 'scope', 'state'):
if param in request.duplicate_params:
- raise errors.InvalidRequestError(state=request.state,
- description='Duplicate %s parameter.' % param, request=request)
+ raise errors.InvalidRequestError(description='Duplicate %s parameter.' % param, request=request)
if not self.request_validator.validate_response_type(request.client_id,
request.response_type, request.client, request):
@@ -326,8 +319,7 @@ class AuthorizationCodeGrant(GrantTypeBase):
# REQUIRED. Value MUST be set to "code".
if request.response_type != 'code':
- raise errors.UnsupportedResponseTypeError(
- state=request.state, request=request)
+ raise errors.UnsupportedResponseTypeError(request=request)
# OPTIONAL. The scope of the access request as described by Section 3.3
# http://tools.ietf.org/html/rfc6749#section-3.3
@@ -352,8 +344,7 @@ class AuthorizationCodeGrant(GrantTypeBase):
for param in ('client_id', 'grant_type', 'redirect_uri'):
if param in request.duplicate_params:
- raise errors.InvalidRequestError(state=request.state,
- description='Duplicate %s parameter.' % param,
+ raise errors.InvalidRequestError(description='Duplicate %s parameter.' % param,
request=request)
if self.request_validator.client_authentication_required(request):
diff --git a/oauthlib/oauth2/rfc6749/grant_types/base.py b/oauthlib/oauth2/rfc6749/grant_types/base.py
index 33b1be7..4a8017f 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/base.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/base.py
@@ -37,5 +37,4 @@ class GrantTypeBase(object):
request.scopes, request.client_id, request.client)
if not self.request_validator.validate_scopes(request.client_id,
request.scopes, request.client, request):
- raise errors.InvalidScopeError(
- state=request.state, request=request)
+ raise errors.InvalidScopeError(request=request)
diff --git a/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py b/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py
index 19f1502..30df247 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py
@@ -92,8 +92,7 @@ class ClientCredentialsGrant(GrantTypeBase):
for param in ('grant_type', 'scope'):
if param in request.duplicate_params:
- raise errors.InvalidRequestError(state=request.state,
- description='Duplicate %s parameter.' % param,
+ raise errors.InvalidRequestError(description='Duplicate %s parameter.' % param,
request=request)
log.debug('Authenticating client, %r.', request)
diff --git a/oauthlib/oauth2/rfc6749/grant_types/implicit.py b/oauthlib/oauth2/rfc6749/grant_types/implicit.py
index 248f84d..27bcb24 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/implicit.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/implicit.py
@@ -263,12 +263,10 @@ class ImplicitGrant(GrantTypeBase):
# REQUIRED. The client identifier as described in Section 2.2.
# http://tools.ietf.org/html/rfc6749#section-2.2
if not request.client_id:
- raise errors.MissingClientIdError(
- state=request.state, request=request)
+ raise errors.MissingClientIdError(request=request)
if not self.request_validator.validate_client_id(request.client_id, request):
- raise errors.InvalidClientIdError(
- state=request.state, request=request)
+ raise errors.InvalidClientIdError(request=request)
# OPTIONAL. As described in Section 3.1.2.
# http://tools.ietf.org/html/rfc6749#section-3.1.2
@@ -276,8 +274,7 @@ class ImplicitGrant(GrantTypeBase):
request.using_default_redirect_uri = False
log.debug('Using provided redirect_uri %s', request.redirect_uri)
if not is_absolute_uri(request.redirect_uri):
- raise errors.InvalidRedirectURIError(
- state=request.state, request=request)
+ raise errors.InvalidRedirectURIError(request=request)
# The authorization server MUST verify that the redirection URI
# to which it will redirect the access token matches a
@@ -286,19 +283,16 @@ class ImplicitGrant(GrantTypeBase):
# http://tools.ietf.org/html/rfc6749#section-3.1.2
if not self.request_validator.validate_redirect_uri(
request.client_id, request.redirect_uri, request):
- raise errors.MismatchingRedirectURIError(
- state=request.state, request=request)
+ raise errors.MismatchingRedirectURIError(request=request)
else:
request.redirect_uri = self.request_validator.get_default_redirect_uri(
request.client_id, request)
request.using_default_redirect_uri = True
log.debug('Using default redirect_uri %s.', request.redirect_uri)
if not request.redirect_uri:
- raise errors.MissingRedirectURIError(
- state=request.state, request=request)
+ raise errors.MissingRedirectURIError(request=request)
if not is_absolute_uri(request.redirect_uri):
- raise errors.InvalidRedirectURIError(
- state=request.state, request=request)
+ raise errors.InvalidRedirectURIError(request=request)
# Then check for normal errors.
@@ -312,19 +306,16 @@ class ImplicitGrant(GrantTypeBase):
# Note that the correct parameters to be added are automatically
# populated through the use of specific exceptions.
if request.response_type is None:
- raise errors.InvalidRequestError(state=request.state,
- description='Missing response_type parameter.',
+ raise errors.InvalidRequestError(description='Missing response_type parameter.',
request=request)
for param in ('client_id', 'response_type', 'redirect_uri', 'scope', 'state'):
if param in request.duplicate_params:
- raise errors.InvalidRequestError(state=request.state,
- description='Duplicate %s parameter.' % param, request=request)
+ raise errors.InvalidRequestError(description='Duplicate %s parameter.' % param, request=request)
# REQUIRED. Value MUST be set to "token".
if request.response_type != 'token':
- raise errors.UnsupportedResponseTypeError(
- state=request.state, request=request)
+ raise errors.UnsupportedResponseTypeError(request=request)
log.debug('Validating use of response_type token for client %r (%r).',
request.client_id, request.client)
diff --git a/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py b/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py
index 2ca8d92..0ab10c9 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py
@@ -114,7 +114,6 @@ class RefreshTokenGrant(GrantTypeBase):
request.scopes, request.refresh_token, request)):
log.debug('Refresh token %s lack requested scopes, %r.',
request.refresh_token, request.scopes)
- raise errors.InvalidScopeError(
- state=request.state, request=request)
+ raise errors.InvalidScopeError(request=request)
else:
request.scopes = original_scopes
diff --git a/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py b/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
index 27df062..c19e6cf 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
@@ -166,8 +166,7 @@ class ResourceOwnerPasswordCredentialsGrant(GrantTypeBase):
for param in ('grant_type', 'username', 'password', 'scope'):
if param in request.duplicate_params:
- raise errors.InvalidRequestError(state=request.state,
- description='Duplicate %s parameter.' % param, request=request)
+ raise errors.InvalidRequestError(description='Duplicate %s parameter.' % param, request=request)
# This error should rarely (if ever) occur if requests are routed to
# grant type handlers based on the grant_type parameter.