Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1.32 KB

README.md

File metadata and controls

41 lines (27 loc) · 1.32 KB

holmes-alf Build Status

Holmes OAuth 2 Sync/Async Clients Wrapper

holmes-alf is a wrapper for OAuth 2 synchronous (based on alf) and asynchronous (based on the tornado-alf) clients that can be used in holmes.

Features

The following features are supported by both alf and tornado-alf:

  • Automatic token retrieving and renewing
  • Token expiration control
  • Automatic retry on status 401 (UNAUTHORIZED)

Usage

Set the following config variables:

AUTHNZ_WRAPPER = 'holmesalf.wrapper.AlfAuthNZWrapper'

OAUTH_TOKEN_ENDPOINT = 'https://oauth-service.com/token-endpoint'
OAUTH_CLIENT_ID = 'client-id'
OAUTH_CLIENT_SECRET = 'client-secret'

Next, you have a sync and an async client at your disposal:

ipdb> type(self.application.authnz_wrapper)
<class 'holmesalf.wrapper.AlfAuthNZWrapper'>
ipdb> type(self.application.authnz_wrapper.sync_client)
<class 'alf.client.Client'>
ipdb> type(self.application.authnz_wrapper.async_client)
<class 'tornadoalf.client.Client'>

License

MIT licensed.