mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 13:39:41 -04:00
reformat private key
This commit is contained in:
@@ -22,15 +22,28 @@ from app.main import main
|
||||
from app.main.forms import LoginForm
|
||||
from app.main.views.verify import activate_user
|
||||
from app.models.user import InvitedUser, User
|
||||
from app.utils import hide_from_search_engines, hilite
|
||||
from app.utils import hide_from_search_engines
|
||||
from app.utils.login import is_safe_redirect_url
|
||||
|
||||
|
||||
def _reformulate_keystring(orig):
|
||||
new_keystring = orig.replace("-----BEGIN PRIVATE KEY-----", "")
|
||||
new_keystring = new_keystring.replace("-----END PRIVATE KEY-----", "")
|
||||
new_keystring = new_keystring.strip()
|
||||
new_keystring = "\n".join(
|
||||
["-----BEGIN PRIVATE KEY-----", new_keystring, "-----END PRIVATE KEY-----"]
|
||||
)
|
||||
new_keystring = f"{new_keystring}\n"
|
||||
return new_keystring
|
||||
|
||||
|
||||
def _get_access_token(code, state):
|
||||
client_id = os.getenv("LOGIN_DOT_GOV_CLIENT_ID")
|
||||
access_token_url = os.getenv("LOGIN_DOT_GOV_ACCESS_TOKEN_URL")
|
||||
keystring = os.getenv("LOGIN_PEM")
|
||||
print(hilite(f"LOGIN_PEM: START{keystring}FINISH")) # noqa temp
|
||||
if " " in keystring:
|
||||
keystring = _reformulate_keystring(keystring)
|
||||
|
||||
payload = {
|
||||
"iss": client_id,
|
||||
"sub": client_id,
|
||||
|
||||
Reference in New Issue
Block a user