mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 17:17:02 +02:00
updated linter length; linter reformatted several files
This commit is contained in:
parent
f0636013e0
commit
c760417e6a
65 changed files with 550 additions and 1727 deletions
|
@ -72,9 +72,7 @@ class Client(oic.Client):
|
|||
try:
|
||||
# discover and store the provider (OP) urls, etc
|
||||
self.provider_config(provider["srv_discovery_url"])
|
||||
self.store_registration_info(
|
||||
RegistrationResponse(**provider["client_registration"])
|
||||
)
|
||||
self.store_registration_info(RegistrationResponse(**provider["client_registration"]))
|
||||
except Exception as err:
|
||||
logger.error(err)
|
||||
logger.error(
|
||||
|
@ -169,9 +167,7 @@ class Client(oic.Client):
|
|||
if isinstance(authn_response, ErrorResponse):
|
||||
error = authn_response.get("error", "")
|
||||
if error == "login_required":
|
||||
logger.warning(
|
||||
"User was not logged in (%s), trying again for %s" % (error, state)
|
||||
)
|
||||
logger.warning("User was not logged in (%s), trying again for %s" % (error, state))
|
||||
return self.create_authn_request(session)
|
||||
else:
|
||||
logger.error("Unable to process response %s for %s" % (error, state))
|
||||
|
@ -190,9 +186,7 @@ class Client(oic.Client):
|
|||
|
||||
if self.behaviour.get("response_type") == "code":
|
||||
# need an access token to get user info (and to log the user out later)
|
||||
self._request_token(
|
||||
authn_response["state"], authn_response["code"], session
|
||||
)
|
||||
self._request_token(authn_response["state"], authn_response["code"], session)
|
||||
|
||||
user_info = self._get_user_info(state, session)
|
||||
|
||||
|
@ -216,10 +210,7 @@ class Client(oic.Client):
|
|||
|
||||
# ErrorResponse is not raised, it is passed back...
|
||||
if isinstance(info_response, ErrorResponse):
|
||||
logger.error(
|
||||
"Unable to get user info (%s) for %s"
|
||||
% (info_response.get("error", ""), state)
|
||||
)
|
||||
logger.error("Unable to get user info (%s) for %s" % (info_response.get("error", ""), state))
|
||||
raise o_e.AuthenticationFailed(locator=state)
|
||||
|
||||
logger.debug("user info: %s" % info_response)
|
||||
|
@ -249,10 +240,7 @@ class Client(oic.Client):
|
|||
|
||||
# ErrorResponse is not raised, it is passed back...
|
||||
if isinstance(token_response, ErrorResponse):
|
||||
logger.error(
|
||||
"Unable to get token (%s) for %s"
|
||||
% (token_response.get("error", ""), state)
|
||||
)
|
||||
logger.error("Unable to get token (%s) for %s" % (token_response.get("error", ""), state))
|
||||
raise o_e.AuthenticationFailed(locator=state)
|
||||
|
||||
logger.debug("token response %s" % token_response)
|
||||
|
|
|
@ -85,12 +85,8 @@ class ViewsTest(TestCase):
|
|||
session.save()
|
||||
# mock
|
||||
mock_client.callback.side_effect = self.user_info
|
||||
mock_client.registration_response = {
|
||||
"post_logout_redirect_uris": ["http://example.com/back"]
|
||||
}
|
||||
mock_client.provider_info = {
|
||||
"end_session_endpoint": "http://example.com/log_me_out"
|
||||
}
|
||||
mock_client.registration_response = {"post_logout_redirect_uris": ["http://example.com/back"]}
|
||||
mock_client.provider_info = {"end_session_endpoint": "http://example.com/log_me_out"}
|
||||
mock_client.client_id = "TEST"
|
||||
# test
|
||||
with less_console_noise():
|
||||
|
|
|
@ -92,11 +92,7 @@ def logout(request, next_page=None):
|
|||
and len(CLIENT.registration_response["post_logout_redirect_uris"]) > 0
|
||||
):
|
||||
request_args.update(
|
||||
{
|
||||
"post_logout_redirect_uri": CLIENT.registration_response[
|
||||
"post_logout_redirect_uris"
|
||||
][0]
|
||||
}
|
||||
{"post_logout_redirect_uri": CLIENT.registration_response["post_logout_redirect_uris"][0]}
|
||||
)
|
||||
|
||||
url = CLIENT.provider_info["end_session_endpoint"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue