Another PEP8 iteration
This commit is contained in:
parent
334986f7b7
commit
69242ed4a3
|
@ -32,7 +32,7 @@ REQUEST2ENDPOINT = {
|
|||
"AuthorizationRequest": "authorization_endpoint",
|
||||
"AccessTokenRequest": "token_endpoint",
|
||||
# ROPCAccessTokenRequest: "authorization_endpoint",
|
||||
# CCAccessTokenRequest: "authorization_endpoint",
|
||||
# CCAccessTokenRequest: "authorization_endpoint",
|
||||
"RefreshAccessTokenRequest": "token_endpoint",
|
||||
"TokenRevocationRequest": "token_endpoint"}
|
||||
|
||||
|
@ -424,7 +424,7 @@ class Client(PBase):
|
|||
self.verify_ssl = verify_ssl
|
||||
# self.secret_type = "basic "
|
||||
|
||||
#self.state = None
|
||||
# self.state = None
|
||||
self.nonce = None
|
||||
|
||||
self.grant = {}
|
||||
|
@ -520,7 +520,7 @@ class Client(PBase):
|
|||
def get_grant(self, state, **kwargs):
|
||||
# try:
|
||||
# _state = kwargs["state"]
|
||||
# if not _state:
|
||||
# if not _state:
|
||||
# _state = self.state
|
||||
# except KeyError:
|
||||
# _state = self.state
|
||||
|
@ -565,8 +565,8 @@ class Client(PBase):
|
|||
|
||||
if extra_args:
|
||||
kwargs.update(extra_args)
|
||||
#logger.debug("kwargs: %s" % kwargs)
|
||||
#logger.debug("request: %s" % request)
|
||||
# logger.debug("kwargs: %s" % kwargs)
|
||||
# logger.debug("request: %s" % request)
|
||||
return request(**kwargs)
|
||||
|
||||
def construct_Message(self, request=Message, request_args=None,
|
||||
|
@ -596,7 +596,7 @@ class Client(PBase):
|
|||
|
||||
return self.construct_request(request, request_args, extra_args)
|
||||
|
||||
#noinspection PyUnusedLocal
|
||||
# noinspection PyUnusedLocal
|
||||
def construct_AccessTokenRequest(self,
|
||||
request=AccessTokenRequest,
|
||||
request_args=None, extra_args=None,
|
||||
|
|
|
@ -10,6 +10,7 @@ from oic.oauth2 import Grant
|
|||
from oic.oauth2 import rndstr
|
||||
from oic.oauth2.message import *
|
||||
|
||||
|
||||
ENDPOINTS = ["authorization_endpoint", "token_endpoint", "userinfo_endpoint",
|
||||
"check_id_endpoint", "registration_endpoint",
|
||||
"token_revokation_endpoint"]
|
||||
|
@ -167,7 +168,7 @@ class Consumer(Client):
|
|||
|
||||
self.sdb[sid] = res
|
||||
|
||||
#noinspection PyUnusedLocal,PyArgumentEqualDefault
|
||||
# noinspection PyUnusedLocal,PyArgumentEqualDefault
|
||||
def begin(self, baseurl, request, response_type="", **kwargs):
|
||||
""" Begin the OAuth2 flow
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ class Provider(provider.Provider):
|
|||
# @staticmethod
|
||||
# def _uris_to_dict(uris):
|
||||
# ruri = {}
|
||||
# for uri in uris:
|
||||
# for uri in uris:
|
||||
# base, query = urllib.splitquery(uri)
|
||||
# if query:
|
||||
# try:
|
||||
|
|
|
@ -193,7 +193,7 @@ class Message(object):
|
|||
"""
|
||||
|
||||
# parse_qs returns a dictionary with keys and values. The values are
|
||||
#always lists even if there is only one value in the list.
|
||||
# always lists even if there is only one value in the list.
|
||||
#keys only appears once.
|
||||
|
||||
if isinstance(urlencoded, basestring):
|
||||
|
@ -329,7 +329,7 @@ class Message(object):
|
|||
|
||||
def _add_value(self, skey, vtyp, key, val, _deser, null_allowed):
|
||||
# if not val:
|
||||
# return
|
||||
# return
|
||||
|
||||
if isinstance(val, list):
|
||||
if (len(val) == 0 or val[0] is None) and null_allowed is False:
|
||||
|
@ -623,7 +623,7 @@ class Message(object):
|
|||
|
||||
return True
|
||||
|
||||
# def __getattr__(self, item):
|
||||
# def __getattr__(self, item):
|
||||
# return self._dict[item]
|
||||
|
||||
def __delitem__(self, key):
|
||||
|
@ -698,7 +698,7 @@ def list_serializer(vals, sformat="urlencoded", lev=0):
|
|||
return vals
|
||||
|
||||
|
||||
#noinspection PyUnusedLocal
|
||||
# noinspection PyUnusedLocal
|
||||
def list_deserializer(val, sformat="urlencoded"):
|
||||
if sformat == "urlencoded":
|
||||
if isinstance(val, basestring):
|
||||
|
|
|
@ -390,7 +390,7 @@ class Provider(object):
|
|||
for _acr in _values:
|
||||
res = self.authn_broker.pick(_acr, comparision_type)
|
||||
if res:
|
||||
#Return the best guess by pick.
|
||||
# Return the best guess by pick.
|
||||
return res[0]
|
||||
except KeyError:
|
||||
pass
|
||||
|
@ -539,7 +539,7 @@ class Provider(object):
|
|||
"none" in areq["response_type"]:
|
||||
pass
|
||||
else:
|
||||
#if self.sdb.is_revoked(sinfo):
|
||||
# if self.sdb.is_revoked(sinfo):
|
||||
# return self._error(error="access_denied",
|
||||
# descr="Token is revoked")
|
||||
|
||||
|
@ -583,7 +583,7 @@ class Provider(object):
|
|||
except (RedirectURIError, ParameterError), err:
|
||||
return BadRequest("%s" % err)
|
||||
|
||||
#self.sdb.store_session(skey)
|
||||
# self.sdb.store_session(skey)
|
||||
|
||||
# so everything went well should set a SSO cookie
|
||||
headers = [authn.create_cookie(user, typ="sso", ttl=self.sso_ttl)]
|
||||
|
@ -594,7 +594,7 @@ class Provider(object):
|
|||
def token_scope_check(self, areq, info):
|
||||
""" Not implemented here """
|
||||
# if not self.subset(areq["scope"], _info["scope"]):
|
||||
# LOG_INFO("Asked for scope which is not subset of previous defined")
|
||||
# LOG_INFO("Asked for scope which is not subset of previous defined")
|
||||
# err = TokenErrorResponse(error="invalid_scope")
|
||||
# return Response(err.to_json(), content="application/json")
|
||||
return None
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from jwkest.jwe import JWE
|
||||
|
||||
from oic.utils.keyio import KeyJar
|
||||
|
||||
|
||||
__author__ = 'rohe0002'
|
||||
|
||||
import urlparse
|
||||
|
@ -213,7 +215,7 @@ PREFERENCE2PROVIDER = {
|
|||
"id_token_encrypted_response_enc":
|
||||
"id_token_encryption_enc_values_supported",
|
||||
"default_acr_values": "acr_values_supported",
|
||||
#"require_auth_time":"",
|
||||
# "require_auth_time":"",
|
||||
"subject_type": "subject_types_supported",
|
||||
"token_endpoint_auth_method": "token_endpoint_auth_methods_supported",
|
||||
"token_endpoint_auth_signing_alg":
|
||||
|
@ -336,7 +338,7 @@ class Client(oauth2.Client):
|
|||
|
||||
if request_args is not None:
|
||||
# if "claims" in request_args:
|
||||
# kwargs["claims"] = request_args["claims"]
|
||||
# kwargs["claims"] = request_args["claims"]
|
||||
# del request_args["claims"]
|
||||
if "nonce" not in request_args:
|
||||
_rt = request_args["response_type"]
|
||||
|
@ -400,7 +402,7 @@ class Client(oauth2.Client):
|
|||
|
||||
return areq
|
||||
|
||||
#noinspection PyUnusedLocal
|
||||
# noinspection PyUnusedLocal
|
||||
def construct_AccessTokenRequest(self, request=AccessTokenRequest,
|
||||
request_args=None, extra_args=None,
|
||||
**kwargs):
|
||||
|
@ -1119,7 +1121,7 @@ class Client(oauth2.Client):
|
|||
return self.wf.discovery_query(principal)
|
||||
|
||||
|
||||
#noinspection PyMethodOverriding
|
||||
# noinspection PyMethodOverriding
|
||||
class Server(oauth2.Server):
|
||||
def __init__(self, keyjar=None, ca_certs=None, verify_ssl=True):
|
||||
oauth2.Server.__init__(self, keyjar, ca_certs, verify_ssl)
|
||||
|
|
|
@ -26,7 +26,7 @@ from oic.utils.authn.client import bearer_auth
|
|||
|
||||
# Used in claims.py
|
||||
# from oic.oic.message import RegistrationRequest
|
||||
#from oic.oic.message import RegistrationResponse
|
||||
# from oic.oic.message import RegistrationResponse
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ class Consumer(Client):
|
|||
"""
|
||||
self.sdb[sid] = self.dictionary()
|
||||
|
||||
#noinspection PyUnusedLocal,PyArgumentEqualDefault
|
||||
# noinspection PyUnusedLocal,PyArgumentEqualDefault
|
||||
def begin(self, scope="", response_type="", use_nonce=False, path="",
|
||||
**kwargs):
|
||||
""" Begin the OIDC flow
|
||||
|
|
|
@ -34,7 +34,7 @@ def json_ser(val, sformat=None, lev=0):
|
|||
return json.dumps(val)
|
||||
|
||||
|
||||
#noinspection PyUnusedLocal
|
||||
# noinspection PyUnusedLocal
|
||||
def json_deser(val, sformat=None, lev=0):
|
||||
return json.loads(val)
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ def devnull(txt):
|
|||
pass
|
||||
|
||||
|
||||
#noinspection PyUnusedLocal
|
||||
# noinspection PyUnusedLocal
|
||||
def do_authorization(user):
|
||||
return ""
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ else:
|
|||
def _verify_saml2_assertion(self, assertion):
|
||||
subject = assertion.subject
|
||||
# client_id = subject.name_id.text
|
||||
#who_ever_issued_it = assertion.issuer.text
|
||||
# who_ever_issued_it = assertion.issuer.text
|
||||
|
||||
audience = []
|
||||
for ar in subject.audience_restiction:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from urlparse import parse_qs
|
||||
|
||||
from oic.utils.authn.user import logger, UsernamePasswordMako
|
||||
|
||||
from oic.utils.http_util import Unauthorized, Redirect
|
||||
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ else:
|
|||
else:
|
||||
self.bindings = [BINDING_HTTP_REDIRECT, BINDING_HTTP_POST,
|
||||
BINDING_HTTP_ARTIFACT]
|
||||
#TODO Why does this exist?
|
||||
# TODO Why does this exist?
|
||||
self.verification_endpoint = ""
|
||||
#Configurations for the SP handler. (pyOpSamlProxy.client.sp.conf)
|
||||
self.sp_conf = importlib.import_module(spconf)
|
||||
|
@ -183,7 +183,7 @@ else:
|
|||
if not allowed:
|
||||
return Unauthorized(self.not_authorized), False
|
||||
|
||||
#logger.info("parsed OK")'
|
||||
# logger.info("parsed OK")'
|
||||
uid = response.assertion.subject.name_id.text
|
||||
if self.userinfo == "AA":
|
||||
if response.entity_id is not None and self.samlcache is not None:
|
||||
|
@ -336,7 +336,7 @@ else:
|
|||
_sid = req_id
|
||||
|
||||
_rstate = rndstr()
|
||||
#self.cache.relay_state[_rstate] = came_from
|
||||
# self.cache.relay_state[_rstate] = came_from
|
||||
ht_args = _cli.apply_binding(binding, msg_str, destination,
|
||||
relay_state=_rstate)
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ class UsernamePasswordMako(UserAuthnMethod):
|
|||
Put up the login form
|
||||
"""
|
||||
# if cookie:
|
||||
# headers = [cookie]
|
||||
# headers = [cookie]
|
||||
# else:
|
||||
# headers = []
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
# This class handles user authentication with CAS.
|
||||
class CasAuthnMethod(UserAuthnMethod):
|
||||
#Standard login url for a CAS server.
|
||||
# Standard login url for a CAS server.
|
||||
CONST_CASLOGIN = "/cas/login?"
|
||||
#Standard URL for validation of a ticket for a CAS server.
|
||||
CONST_CAS_VERIFY_TICKET = "/serviceValidate"
|
||||
|
|
|
@ -748,7 +748,7 @@ def proper_path(path):
|
|||
#
|
||||
# def make_req(bits, fqdn="example.com", rsa=None):
|
||||
# pk = EVP.PKey()
|
||||
# x = X509.Request()
|
||||
# x = X509.Request()
|
||||
# if not rsa:
|
||||
# rsa = RSA.gen_key(bits, 65537, lambda: None)
|
||||
# pk.assign_rsa(rsa)
|
||||
|
|
|
@ -333,7 +333,7 @@ class SessionDB(object):
|
|||
# dic["client_id_issued_at"] = utc_time_sans_frac()
|
||||
dic["access_token"] = access_token
|
||||
self._db[sid] = dic
|
||||
#self._db[dic["xxxx"]] = dic
|
||||
# self._db[dic["xxxx"]] = dic
|
||||
return dic
|
||||
else:
|
||||
raise WrongTokenType("Not a refresh token!")
|
||||
|
@ -377,11 +377,11 @@ class SessionDB(object):
|
|||
except KeyError:
|
||||
return False
|
||||
|
||||
# def set_oir(self, key, oir):
|
||||
# self._db[key] = oir.dictionary()
|
||||
#
|
||||
# def get_oir(self, key):
|
||||
# return OpenIDRequest(**self._db[key])
|
||||
# def set_oir(self, key, oir):
|
||||
# self._db[key] = oir.dictionary()
|
||||
#
|
||||
# def get_oir(self, key):
|
||||
# return OpenIDRequest(**self._db[key])
|
||||
|
||||
def revoke_token(self, token):
|
||||
# revokes either the refresh token or the access token
|
||||
|
|
|
@ -34,7 +34,7 @@ TIME_FORMAT_WITH_FRAGMENT = re.compile(
|
|||
# ---------------------------------------------------------------------------
|
||||
# I'm sure this is implemented somewhere else can't find it now though, so I
|
||||
# made an attempt.
|
||||
#Implemented according to
|
||||
# Implemented according to
|
||||
#http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/
|
||||
#adding-durations-to-dateTimes
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ OPENID2LDAP = {
|
|||
# "email_verified":
|
||||
"gender": "schacGender",
|
||||
"birthdate": "schacDateOfBirth",
|
||||
#zoneinfo
|
||||
# zoneinfo
|
||||
"locale": "preferredLanguage",
|
||||
"phone_number": "telephoneNumber",
|
||||
#phone_number_verified
|
||||
|
|
Reference in New Issue