Refactor and rename the standard OAuth services

This commit is contained in:
Joseph Schorr 2017-01-19 15:23:15 -05:00
parent bee2551dc2
commit 4755d08677
6 changed files with 82 additions and 242 deletions

View file

@ -7,7 +7,7 @@ from peewee import IntegrityError
import features
from app import app, analytics, get_app_url, github_login, google_login, dex_login
from app import app, analytics, get_app_url, github_login, google_login
from auth.process import require_session_login
from data import model
from endpoints.common import common_login, route_show_if
@ -281,14 +281,3 @@ def github_oauth_attach():
return redirect(url_for('web.user_view', path=user_obj.username, tab='external'))
def decode_user_jwt(token, oidc_provider):
try:
return decode(token, oidc_provider.get_public_key(), algorithms=['RS256'],
audience=oidc_provider.client_id(),
issuer=oidc_provider.issuer)
except InvalidTokenError:
# Public key may have expired. Try to retrieve an updated public key and use it to decode.
return decode(token, oidc_provider.get_public_key(force_refresh=True), algorithms=['RS256'],
audience=oidc_provider.client_id(),
issuer=oidc_provider.issuer)