Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
feudal
feudalBackend
Commits
706dda00
Commit
706dda00
authored
Oct 29, 2018
by
Lukas Burgey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle a specific exception in the auth process
parent
48b6b49d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
feudal/backend/auth/v1/views/webpage.py
feudal/backend/auth/v1/views/webpage.py
+21
-12
No files found.
feudal/backend/auth/v1/views/webpage.py
View file @
706dda00
...
...
@@ -9,6 +9,7 @@ from django.shortcuts import redirect
from
django.views
import
View
from
oic
import
rndstr
from
oic.oic.message
import
AuthorizationResponse
from
oic.oauth2.exception
import
HttpError
from
rest_framework
import
generics
,
views
from
rest_framework.permissions
import
AllowAny
from
rest_framework.response
import
Response
...
...
@@ -31,7 +32,6 @@ def select_oidc_config(request):
issuer_uri_urlenc
=
request
.
GET
.
get
(
'idp'
,
None
)
idp_id
=
request
.
COOKIES
.
get
(
IDP_COOKIE_NAME
,
None
)
# IdP selection using the 'idp' url parameter
try
:
if
issuer_uri_urlenc
is
not
None
:
...
...
@@ -109,20 +109,29 @@ class AuthCallback(View):
if
not
state
==
aresp
[
'state'
]:
raise
AuthException
(
'AuthCallback: States do not match'
)
ac_token_response
=
(
oidc_client
.
do_access_token_request
(
state
=
state
,
request_args
=
{
'code'
:
aresp
[
'code'
]
},
ac_token_response
=
None
try
:
ac_token_response
=
(
oidc_client
.
do_access_token_request
(
state
=
state
,
request_args
=
{
'code'
:
aresp
[
'code'
]
},
)
)
)
except
HttpError
as
exception
:
# this exception is throw
LOGGER
.
error
(
'AuthCallback: Access Token Request: %s'
,
exception
)
# the error is deleted from the session when the state is delivered
request
.
session
[
'error'
]
=
'Server Communication Error'
return
redirect
(
'/'
)
# TODO retry in the future
#pyoidc_userinfo = oidc_client.do_user_info_request(
# state=aresp["state"],
#)
#LOGGER.debug("pyoidc: %s", pyoidc_userinfo)
#
pyoidc_userinfo = oidc_client.do_user_info_request(
#
state=aresp["state"],
#
)
#
LOGGER.debug("pyoidc: %s", pyoidc_userinfo)
user
=
authenticate
(
request
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment