Skip to content

Commit 04af300

Browse files
committed
fix(oauth): login by password
1 parent b73e575 commit 04af300

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

charts/passport/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ initApplications:
8989
key: ""
9090
secret: ""
9191
prefix: "drycc"
92+
grant_type: "password"
9293
redirect_uri: "/v2/complete/drycc/"
9394
- name: "grafana"
9495
key: ""
9596
secret: ""
9697
prefix: "drycc-monitor-grafana"
98+
grant_type: "authorization-code"
9799
redirect_uri: "/login/generic_oauth"
98100

99101
# Service

rootfs/api/management/commands/create_oauth2_application.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,14 @@ def handle(self, *args, **options):
2828
user = User.objects.filter(is_superuser=True).first()
2929
for item in json.loads(pathlib.Path(base_path).read_text()):
3030
name = item["name"]
31-
key = self._get_creds(item, "key", 40)
32-
secret = self._get_creds(item, "secret", 60)
33-
redirect_uri = self._get_redirect_uri(item)
3431
_, updated = Application.objects.update_or_create(
3532
name=name.lower(),
3633
defaults={
37-
'client_id': key,
38-
'client_secret': secret,
34+
'client_id': self._get_creds(item, "key", 40),
35+
'client_secret': self._get_creds(item, "secret", 60),
3936
'user': user,
40-
'redirect_uris': redirect_uri,
41-
'authorization_grant_type': 'authorization-code',
37+
'redirect_uris': self._get_redirect_uri(item),
38+
'authorization_grant_type': item['grant_type'],
4239
'client_type': 'public',
4340
'algorithm': 'RS256'
4441
}

0 commit comments

Comments
 (0)