|
3 | 3 |
|
4 | 4 | import click |
5 | 5 |
|
6 | | -from alertaclient.auth import github, gitlab, google |
| 6 | +from alertaclient.auth import azure, github, gitlab, google, oidc |
7 | 7 | from alertaclient.auth.token import Jwt |
8 | 8 | from alertaclient.auth.utils import save_token |
9 | 9 | from alertaclient.exceptions import AuthError |
|
13 | 13 | @click.argument('username', required=False) |
14 | 14 | @click.pass_obj |
15 | 15 | def cli(obj, username): |
16 | | - """Authenticate using Github, Gitlab, Google OAuth2 or Basic Auth |
17 | | - username/password instead of using an API key.""" |
| 16 | + """Authenticate using Azure, Github, Gitlab, Google OAuth2, OpenID or |
| 17 | + Basic Auth username/password instead of using an API key.""" |
18 | 18 | client = obj['client'] |
19 | 19 | provider = obj['provider'] |
20 | 20 | client_id = obj['client_id'] |
21 | 21 |
|
22 | 22 | try: |
23 | | - if provider == 'github': |
| 23 | + if provider == 'azure': |
| 24 | + token = azure.login(client, obj['azure_tenant'], client_id)['token'] |
| 25 | + elif provider == 'github': |
24 | 26 | token = github.login(client, obj['github_url'], client_id)['token'] |
25 | 27 | elif provider == 'gitlab': |
26 | 28 | token = gitlab.login(client, obj['gitlab_url'], client_id)['token'] |
27 | 29 | elif provider == 'google': |
28 | 30 | if not username: |
29 | 31 | username = click.prompt('Email') |
30 | 32 | token = google.login(client, username, client_id)['token'] |
| 33 | + elif provider == 'openid': |
| 34 | + token = oidc.login(client, obj['oidc_auth_url'], client_id)['token'] |
31 | 35 | elif provider == 'basic': |
32 | 36 | if not username: |
33 | 37 | username = click.prompt('Email') |
|
0 commit comments