Skip to content

Commit eff9c22

Browse files
authored
feat(auth): add HMAC authentication as config option (#248)
1 parent 943a624 commit eff9c22

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

alertaclient/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class Client:
3232

3333
DEFAULT_ENDPOINT = 'http://localhost:8080'
3434

35-
def __init__(self, endpoint=None, key=None, secret=None, token=None, username=None, password=None, timeout=5.0, ssl_verify=True,
36-
ssl_cert=None, ssl_key=None, headers=None, debug=False):
35+
def __init__(self, endpoint=None, key=None, secret=None, token=None, username=None, password=None, timeout=5.0,
36+
ssl_verify=True, ssl_cert=None, ssl_key=None, headers=None, debug=False):
3737
self.endpoint = endpoint or os.environ.get('ALERTA_ENDPOINT', self.DEFAULT_ENDPOINT)
3838

3939
if debug:

alertaclient/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def cli(ctx, config_file, profile, endpoint_url, output, color, debug):
6363
ctx.obj['client'] = Client(
6464
endpoint=endpoint,
6565
key=config.options['key'],
66+
secret=config.options['secret'],
6667
token=get_token(endpoint),
6768
username=config.options.get('username', None),
6869
password=config.options.get('password', None),

alertaclient/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'profile': None,
1212
'endpoint': 'http://localhost:8080',
1313
'key': '',
14+
'secret': None,
1415
'client_id': None,
1516
'username': None,
1617
'password': None,

examples/alerta.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ key = demo-key
1919
[profile development]
2020
endpoint = http://localhost:8080
2121
key = demo-key
22+
23+
[profile hmac-auth]
24+
endpoint = http://localhost:9080/api
25+
key = access-key
26+
secret = secret-key

0 commit comments

Comments
 (0)