-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from arXiv/ntai/openid-connect-step-1
[WIP] OpenID connect client library - eyeing toward deploying keycloak
- Loading branch information
Showing
14 changed files
with
1,287 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,4 +129,5 @@ dist/ | |
|
||
fastly_hourly_stats.ini | ||
|
||
test.db-journal | ||
foo.json | ||
test.db-journal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from . import domain | ||
from .legacy.util import _compute_capabilities | ||
from .user_claims import ArxivUserClaims | ||
from .legacy.authenticate import instantiate_tapir_user, _get_user_by_user_id | ||
from ..db import transaction | ||
from .legacy.sessions import create as legacy_create_session | ||
from .legacy.cookies import pack as legacy_pack | ||
|
||
def populate_user_claims(user_claims: ArxivUserClaims): | ||
""" | ||
Populate the user's claims to the universe | ||
""" | ||
with transaction(): | ||
passdata = _get_user_by_user_id(user_claims.user_id) | ||
d_user, d_auth = instantiate_tapir_user(passdata) | ||
|
||
session: domain.Session = legacy_create_session(d_auth, user=d_user, | ||
tracking_cookie=user_claims.session_id) | ||
user_claims.update_claims('tapir_session_id', session.session_id) | ||
|
||
|
||
def bake_cookies(user_claims: ArxivUserClaims) -> (str, str): | ||
|
||
cit_cookie = legacy_pack(user_claims.tapir_session_id, | ||
issued_at=user_claims.issued_at, | ||
user_id=user_claims.user_id, | ||
capabilities=_compute_capabilities( | ||
user_claims.is_admin, | ||
user_claims.email_verified, | ||
user_claims.is_god | ||
)) | ||
|
||
return cit_cookie, ArxivUserClaims.to_arxiv_token_string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.