8000 Session Management API by hiranya911 · Pull Request #147 · firebase/firebase-admin-python · GitHub
[go: up one dir, main page]

Skip to content

Session Management API #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 4, 2018
Merged

Session Management API #147

merged 11 commits into from
Apr 4, 2018

Conversation

hiranya911
Copy link
Contributor

Adds 2 new functions to the auth module:

create_session_cookie(id_token, expires_in, app=None)
verify_session_cookie(session_cookie, check_revoked=False, app=None)

finally:
firebase_admin.delete_app(app)

@pytest.mark.parametrize('env_var_app', [{'GCLOUD_PROJECT': 'mock-project-id'}], indirect=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below, why parametrize for a single test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are passed indirectly (indirect=True) to a fixture.

assert claims['subscription'] == 'silver'
assert claims['iss'].startswith('https://session.firebase.google.com')
estimated_exp = int(time.time() + expires_in.total_seconds())
assert abs(claims['exp'] - estimated_exp) < 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 5 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arbitrary. It's the same value we used in Node.js tests.

@hiranya911 hiranya911 assigned hiranya911 and unassigned avishalom Apr 4, 2018
@hiranya911 hiranya911 merged commit 18eb9aa into master Apr 4, 2018
@hiranya911 hiranya911 deleted the hkj-session-mgt branch April 4, 2018 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0