mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-20 11:29:25 +02:00
openid tests
This commit is contained in:
parent
1df7dc48df
commit
6820456286
2 changed files with 140 additions and 39 deletions
|
@ -27,6 +27,10 @@ def _initialize_client():
|
|||
CLIENT = Client(OP)
|
||||
logger.debug("Client initialized: %s" % CLIENT)
|
||||
|
||||
def _client_is_none():
|
||||
""" Return if the CLIENT is currently None."""
|
||||
global CLIENT
|
||||
return CLIENT is None
|
||||
|
||||
# Initialize CLIENT
|
||||
try:
|
||||
|
@ -71,7 +75,7 @@ def openid(request):
|
|||
global CLIENT
|
||||
try:
|
||||
# If the CLIENT is none, attempt to reinitialize before handling the request
|
||||
if CLIENT is None:
|
||||
if _client_is_none():
|
||||
_initialize_client()
|
||||
request.session["acr_value"] = CLIENT.get_default_acr_value()
|
||||
request.session["next"] = request.GET.get("next", "/")
|
||||
|
@ -86,7 +90,7 @@ def login_callback(request):
|
|||
global CLIENT
|
||||
try:
|
||||
# If the CLIENT is none, attempt to reinitialize before handling the request
|
||||
if CLIENT is None:
|
||||
if _client_is_none():
|
||||
_initialize_client()
|
||||
query = parse_qs(request.GET.urlencode())
|
||||
userinfo = CLIENT.callback(query, request.session)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue