initial for login.gov integration

This commit is contained in:
Kenneth Kehl
2023-10-18 15:18:37 -07:00
parent df3cdaf93e
commit 86ac810fff
3 changed files with 13 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ from itertools import chain
from numbers import Number
import pytz
import requests
from flask import Markup, render_template, request
from flask_login import current_user
from flask_wtf import FlaskForm as Form

View File

@@ -24,6 +24,15 @@ from app.utils.login import is_safe_redirect_url
@main.route("/sign-in", methods=(["GET", "POST"]))
@hide_from_search_engines
def sign_in():
code = request.args.get("code")
state = request.args.get("state")
if code and state:
print(f"HURRAY! THIS IS REDIRECT FROM LOGIN DOT GOV AND WE HAVE CODE {code} and STATE {state}")
# TODO use the code to get the access_token with jwt
# Using the access_token get the email from the user info
# Use the call five lines down to look up the user from the email
# activate the user and redirect as five lines down
redirect_url = request.args.get("next")
if os.getenv("NOTIFY_E2E_TEST_EMAIL"):

View File

@@ -29,10 +29,10 @@
{% else %}
<h1 class="font-body-2xl margin-bottom-3">Sign in</h1>
<!-- Removing temporarily for pilot -->
<!-- <p>
<p>
If you do not have an account, you can
<a class="usa-link" href="{{ url_for('.register') }}">create one now</a>.
</p> -->
<a class="usa-link" href="https://idp.int.identitysandbox.gov/openid_connect/authorize?acr_values=http%3A%2F%2Fidmanagement.gov%2Fns%2Fassurance%2Fial%2F1&client_id=urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:test_notify_gov&nonce=01234567890123456789012345&prompt=select_account&redirect_uri=http://localhost:6012/sign-in&response_type=code&scope=openid+email&state=abcdefghijklmnopabcdefghijklmnop">Login.gov</a>.
</p>
{% endif %}
{% call form_wrapper(autocomplete=True) %}