mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
reformat private key
This commit is contained in:
@@ -26,7 +26,7 @@ from app.utils import hide_from_search_engines
|
||||
from app.utils.login import is_safe_redirect_url
|
||||
|
||||
|
||||
def _reformulate_keystring(orig):
|
||||
def _reformat_keystring(orig):
|
||||
new_keystring = orig.replace("-----BEGIN PRIVATE KEY-----", "")
|
||||
new_keystring = new_keystring.replace("-----END PRIVATE KEY-----", "")
|
||||
new_keystring = new_keystring.strip()
|
||||
@@ -42,7 +42,7 @@ def _get_access_token(code, state):
|
||||
access_token_url = os.getenv("LOGIN_DOT_GOV_ACCESS_TOKEN_URL")
|
||||
keystring = os.getenv("LOGIN_PEM")
|
||||
if " " in keystring:
|
||||
keystring = _reformulate_keystring(keystring)
|
||||
keystring = _reformat_keystring(keystring)
|
||||
|
||||
payload = {
|
||||
"iss": client_id,
|
||||
|
||||
@@ -3,7 +3,7 @@ import uuid
|
||||
import pytest
|
||||
from flask import url_for
|
||||
|
||||
from app.main.views.sign_in import _reformulate_keystring
|
||||
from app.main.views.sign_in import _reformat_keystring
|
||||
from app.models.user import User
|
||||
from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
|
||||
@@ -40,14 +40,14 @@ def test_render_sign_in_template_with_next_link_for_password_reset(client_reques
|
||||
)
|
||||
|
||||
|
||||
def test_reformulate_keystring():
|
||||
def test_reformat_keystring():
|
||||
orig = "-----BEGIN PRIVATE KEY----- blahblahblah -----END PRIVATE KEY-----"
|
||||
expected = """-----BEGIN PRIVATE KEY-----
|
||||
blahblahblah
|
||||
-----END PRIVATE KEY-----
|
||||
"""
|
||||
reformulated = _reformulate_keystring(orig)
|
||||
assert reformulated == expected
|
||||
reformatted = _reformat_keystring(orig)
|
||||
assert reformatted == expected
|
||||
|
||||
|
||||
def test_sign_in_explains_session_timeout(client_request):
|
||||
|
||||
Reference in New Issue
Block a user