summaryrefslogtreecommitdiff
path: root/oauthlib/openid/connect/core
diff options
context:
space:
mode:
authorJonathan Huot <JonathanHuot@users.noreply.github.com>2019-08-30 11:56:43 +0200
committerGitHub <noreply@github.com>2019-08-30 11:56:43 +0200
commitca57b0bcae835493d9db8f9bf1f1228b71b8e3f8 (patch)
tree71f3d2ecee2ffd32da6f030558d0eed91d953895 /oauthlib/openid/connect/core
parent1f3fc4bfd4fd51711798186591bf3e3ba5a894be (diff)
parent11bf0eca2857f5330237e574630dd916d53cd573 (diff)
downloadoauthlib-ca57b0bcae835493d9db8f9bf1f1228b71b8e3f8.tar.gz
Merge pull request #700 from hugovk/rm-2.7
Drop support for Python 2.7
Diffstat (limited to 'oauthlib/openid/connect/core')
-rw-r--r--oauthlib/openid/connect/core/endpoints/__init__.py2
-rw-r--r--oauthlib/openid/connect/core/endpoints/pre_configured.py2
-rw-r--r--oauthlib/openid/connect/core/endpoints/userinfo.py5
-rw-r--r--oauthlib/openid/connect/core/exceptions.py2
-rw-r--r--oauthlib/openid/connect/core/grant_types/__init__.py2
-rw-r--r--oauthlib/openid/connect/core/grant_types/authorization_code.py4
-rw-r--r--oauthlib/openid/connect/core/grant_types/base.py4
-rw-r--r--oauthlib/openid/connect/core/grant_types/dispatchers.py2
-rw-r--r--oauthlib/openid/connect/core/grant_types/exceptions.py2
-rw-r--r--oauthlib/openid/connect/core/grant_types/hybrid.py4
-rw-r--r--oauthlib/openid/connect/core/grant_types/implicit.py6
-rw-r--r--oauthlib/openid/connect/core/request_validator.py2
-rw-r--r--oauthlib/openid/connect/core/tokens.py3
13 files changed, 9 insertions, 31 deletions
diff --git a/oauthlib/openid/connect/core/endpoints/__init__.py b/oauthlib/openid/connect/core/endpoints/__init__.py
index 528841f..92f1ba9 100644
--- a/oauthlib/openid/connect/core/endpoints/__init__.py
+++ b/oauthlib/openid/connect/core/endpoints/__init__.py
@@ -6,7 +6,5 @@ oauthlib.oopenid.core
This module is an implementation of various logic needed
for consuming and providing OpenID Connect
"""
-from __future__ import absolute_import, unicode_literals
-
from .pre_configured import Server
from .userinfo import UserInfoEndpoint
diff --git a/oauthlib/openid/connect/core/endpoints/pre_configured.py b/oauthlib/openid/connect/core/endpoints/pre_configured.py
index fde2739..ad2faa7 100644
--- a/oauthlib/openid/connect/core/endpoints/pre_configured.py
+++ b/oauthlib/openid/connect/core/endpoints/pre_configured.py
@@ -6,8 +6,6 @@ oauthlib.openid.connect.core.endpoints.pre_configured
This module is an implementation of various endpoints needed
for providing OpenID Connect servers.
"""
-from __future__ import absolute_import, unicode_literals
-
from oauthlib.oauth2.rfc6749.endpoints import (
AuthorizationEndpoint,
IntrospectEndpoint,
diff --git a/oauthlib/openid/connect/core/endpoints/userinfo.py b/oauthlib/openid/connect/core/endpoints/userinfo.py
index 7a39f76..dc73373 100644
--- a/oauthlib/openid/connect/core/endpoints/userinfo.py
+++ b/oauthlib/openid/connect/core/endpoints/userinfo.py
@@ -4,13 +4,10 @@ oauthlib.openid.connect.core.endpoints.userinfo
This module is an implementation of userinfo endpoint.
"""
-from __future__ import absolute_import, unicode_literals
-
import json
import logging
from oauthlib.common import Request
-from oauthlib.common import unicode_type
from oauthlib.oauth2.rfc6749.endpoints.base import BaseEndpoint
from oauthlib.oauth2.rfc6749.endpoints.base import catch_errors_and_unavailability
from oauthlib.oauth2.rfc6749.tokens import BearerToken
@@ -55,7 +52,7 @@ class UserInfoEndpoint(BaseEndpoint):
log.error('Userinfo MUST have "sub" for %r.', request)
raise errors.ServerError(status_code=500)
body = json.dumps(claims)
- elif isinstance(claims, unicode_type):
+ elif isinstance(claims, str):
resp_headers = {
'Content-Type': 'application/jwt'
}
diff --git a/oauthlib/openid/connect/core/exceptions.py b/oauthlib/openid/connect/core/exceptions.py
index 8b08d21..aa795e0 100644
--- a/oauthlib/openid/connect/core/exceptions.py
+++ b/oauthlib/openid/connect/core/exceptions.py
@@ -6,8 +6,6 @@ oauthlib.oauth2.rfc6749.errors
Error used both by OAuth 2 clients and providers to represent the spec
defined error responses for all four core grant types.
"""
-from __future__ import unicode_literals
-
from oauthlib.oauth2.rfc6749.errors import FatalClientError, OAuth2Error
diff --git a/oauthlib/openid/connect/core/grant_types/__init__.py b/oauthlib/openid/connect/core/grant_types/__init__.py
index 63f30ac..4e7b474 100644
--- a/oauthlib/openid/connect/core/grant_types/__init__.py
+++ b/oauthlib/openid/connect/core/grant_types/__init__.py
@@ -3,8 +3,6 @@
oauthlib.openid.connect.core.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
-from __future__ import unicode_literals, absolute_import
-
from .authorization_code import AuthorizationCodeGrant
from .implicit import ImplicitGrant
from .base import GrantTypeBase
diff --git a/oauthlib/openid/connect/core/grant_types/authorization_code.py b/oauthlib/openid/connect/core/grant_types/authorization_code.py
index becfcfa..d07d138 100644
--- a/oauthlib/openid/connect/core/grant_types/authorization_code.py
+++ b/oauthlib/openid/connect/core/grant_types/authorization_code.py
@@ -3,8 +3,6 @@
oauthlib.openid.connect.core.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
-from __future__ import absolute_import, unicode_literals
-
import logging
from oauthlib.oauth2.rfc6749.grant_types.authorization_code import AuthorizationCodeGrant as OAuth2AuthorizationCodeGrant
@@ -41,4 +39,4 @@ class AuthorizationCodeGrant(GrantTypeBase):
request.redirect_uri,
request
)
- return super(AuthorizationCodeGrant, self).add_id_token(token, token_handler, request, nonce=nonce)
+ return super().add_id_token(token, token_handler, request, nonce=nonce)
diff --git a/oauthlib/openid/connect/core/grant_types/base.py b/oauthlib/openid/connect/core/grant_types/base.py
index 32a21b6..cd27237 100644
--- a/oauthlib/openid/connect/core/grant_types/base.py
+++ b/oauthlib/openid/connect/core/grant_types/base.py
@@ -11,7 +11,7 @@ from oauthlib.oauth2.rfc6749.errors import ConsentRequired, InvalidRequestError,
log = logging.getLogger(__name__)
-class GrantTypeBase(object):
+class GrantTypeBase:
# Just proxy the majority of method calls through to the
# proxy_target grant type handler, which will usually be either
@@ -20,7 +20,7 @@ class GrantTypeBase(object):
return getattr(self.proxy_target, attr)
def __setattr__(self, attr, value):
- proxied_attrs = set(('refresh_token', 'response_types'))
+ proxied_attrs = {'refresh_token', 'response_types'}
if attr in proxied_attrs:
setattr(self.proxy_target, attr, value)
else:
diff --git a/oauthlib/openid/connect/core/grant_types/dispatchers.py b/oauthlib/openid/connect/core/grant_types/dispatchers.py
index be8e2f3..541467a 100644
--- a/oauthlib/openid/connect/core/grant_types/dispatchers.py
+++ b/oauthlib/openid/connect/core/grant_types/dispatchers.py
@@ -2,7 +2,7 @@ import logging
log = logging.getLogger(__name__)
-class Dispatcher(object):
+class Dispatcher:
default_grant = None
oidc_grant = None
diff --git a/oauthlib/openid/connect/core/grant_types/exceptions.py b/oauthlib/openid/connect/core/grant_types/exceptions.py
index 809f1b3..4636fe7 100644
--- a/oauthlib/openid/connect/core/grant_types/exceptions.py
+++ b/oauthlib/openid/connect/core/grant_types/exceptions.py
@@ -29,4 +29,4 @@ class OIDCNoPrompt(Exception):
"for authorization, it should been done using silent "
"authentication through create_authorization_response. "
"See OIDCNoPrompt.__doc__ for more details.")
- super(OIDCNoPrompt, self).__init__(msg)
+ super().__init__(msg)
diff --git a/oauthlib/openid/connect/core/grant_types/hybrid.py b/oauthlib/openid/connect/core/grant_types/hybrid.py
index 685fa08..caf8547 100644
--- a/oauthlib/openid/connect/core/grant_types/hybrid.py
+++ b/oauthlib/openid/connect/core/grant_types/hybrid.py
@@ -3,8 +3,6 @@
oauthlib.openid.connect.core.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
-from __future__ import absolute_import, unicode_literals
-
import logging
from oauthlib.oauth2.rfc6749.grant_types.authorization_code import AuthorizationCodeGrant as OAuth2AuthorizationCodeGrant
@@ -39,7 +37,7 @@ class HybridGrant(GrantTypeBase):
def openid_authorization_validator(self, request):
"""Additional validation when following the Authorization Code flow.
"""
- request_info = super(HybridGrant, self).openid_authorization_validator(request)
+ request_info = super().openid_authorization_validator(request)
if not request_info: # returns immediately if OAuth2.0
return request_info
diff --git a/oauthlib/openid/connect/core/grant_types/implicit.py b/oauthlib/openid/connect/core/grant_types/implicit.py
index c2dbc27..62f63f9 100644
--- a/oauthlib/openid/connect/core/grant_types/implicit.py
+++ b/oauthlib/openid/connect/core/grant_types/implicit.py
@@ -3,8 +3,6 @@
oauthlib.openid.connect.core.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
-from __future__ import absolute_import, unicode_literals
-
import logging
from .base import GrantTypeBase
@@ -29,12 +27,12 @@ class ImplicitGrant(GrantTypeBase):
def add_id_token(self, token, token_handler, request):
if 'state' not in token and request.state:
token['state'] = request.state
- return super(ImplicitGrant, self).add_id_token(token, token_handler, request, nonce=request.nonce)
+ return super().add_id_token(token, token_handler, request, nonce=request.nonce)
def openid_authorization_validator(self, request):
"""Additional validation when following the implicit flow.
"""
- request_info = super(ImplicitGrant, self).openid_authorization_validator(request)
+ request_info = super().openid_authorization_validator(request)
if not request_info: # returns immediately if OAuth2.0
return request_info
diff --git a/oauthlib/openid/connect/core/request_validator.py b/oauthlib/openid/connect/core/request_validator.py
index e853d39..ebc07dc 100644
--- a/oauthlib/openid/connect/core/request_validator.py
+++ b/oauthlib/openid/connect/core/request_validator.py
@@ -3,8 +3,6 @@
oauthlib.openid.connect.core.request_validator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
-from __future__ import absolute_import, unicode_literals
-
import logging
from oauthlib.oauth2.rfc6749.request_validator import RequestValidator as OAuth2RequestValidator
diff --git a/oauthlib/openid/connect/core/tokens.py b/oauthlib/openid/connect/core/tokens.py
index b67cdf2..d24cb56 100644
--- a/oauthlib/openid/connect/core/tokens.py
+++ b/oauthlib/openid/connect/core/tokens.py
@@ -4,9 +4,6 @@ authlib.openid.connect.core.tokens
This module contains methods for adding JWT tokens to requests.
"""
-from __future__ import absolute_import, unicode_literals
-
-
from oauthlib.oauth2.rfc6749.tokens import TokenBase, random_token_generator