Skip to content
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

Adding support for Bearer Token (OAuth2) #49

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

landerlini
Copy link

Using oauth2proxy it is not difficult to configure ELOG to authenticate users based on IAM client.
Unfortunately, passing through the proxy with this python client requires adding a header including the Bearer token generated by the user interacting with the IAM.

This pull request introduces an additional argument to the constructor of the elog object to pass an access token.
Since the client application may have it's own workflow to keep the access token updated, the argument can be a callable, in which case it is called to retrieve the token at each call.

Example.

logbook = elog.open(
    'https://elog.example.com', 
    'my_logbook', 
    use_ssl=True, 
    port=443, 
    user='my_username',
    bearer_token=lambda: open("/path/to/my/token").read()
)

logbook.get_message_ids()

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.

1 participant