From cad913c39f899915300da8d3e8f230b7da39ace8 Mon Sep 17 00:00:00 2001 From: lijianguo Date: Fri, 13 Aug 2021 14:55:57 +0800 Subject: [PATCH] chore(oauth): modify passport api --- charts/controller/templates/_helpers.tpl | 4 ++-- rootfs/api/backend.py | 2 +- rootfs/api/oauth.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/controller/templates/_helpers.tpl b/charts/controller/templates/_helpers.tpl index b421801d..facb4de3 100644 --- a/charts/controller/templates/_helpers.tpl +++ b/charts/controller/templates/_helpers.tpl @@ -148,7 +148,7 @@ env: - name: "SOCIAL_AUTH_DRYCC_ACCESS_TOKEN_URL" value: "$(DRYCC_PASSPORT_DOMAIN)/oauth/token/" - name: "SOCIAL_AUTH_DRYCC_ACCESS_API_URL" - value: "$(DRYCC_PASSPORT_DOMAIN)/users/" + value: "$(DRYCC_PASSPORT_DOMAIN)" - name: "SOCIAL_AUTH_DRYCC_USERINFO_URL" value: "$(DRYCC_PASSPORT_DOMAIN)/oauth/userinfo/" - name: "SOCIAL_AUTH_DRYCC_JWKS_URI" @@ -156,7 +156,7 @@ env: - name: "SOCIAL_AUTH_DRYCC_OIDC_ENDPOINT" value: "$(DRYCC_PASSPORT_DOMAIN)/oauth" - name: "LOGIN_REDIRECT_URL" - value: "$(DRYCC_PASSPORT_DOMAIN)/login/done/" + value: "$(DRYCC_PASSPORT_DOMAIN)/user/login/done/" - name: SOCIAL_AUTH_DRYCC_CONTROLLER_KEY valueFrom: secretKeyRef: diff --git a/rootfs/api/backend.py b/rootfs/api/backend.py index f4aea288..53f06958 100644 --- a/rootfs/api/backend.py +++ b/rootfs/api/backend.py @@ -67,7 +67,7 @@ def get_user_details(self, response): def user_data(self, access_token, *args, **kwargs): """Loads user data from service""" - url = settings.SOCIAL_AUTH_DRYCC_ACCESS_API_URL + url = settings.SOCIAL_AUTH_DRYCC_USERINFO_URL return self.get_json(url, headers={ 'authorization': 'Bearer ' + access_token}) diff --git a/rootfs/api/oauth.py b/rootfs/api/oauth.py index 2eefd78c..90d0fb9a 100644 --- a/rootfs/api/oauth.py +++ b/rootfs/api/oauth.py @@ -15,14 +15,14 @@ def __init__(self): self.client = OAuth2Session(self.client_id, self.client_secret) def get_user_by_token(self, token: str) -> Dict: - response = requests.get(f'{self.api_url}/users', headers={ + response = requests.get(f'{self.api_url}/user/info/', headers={ 'Authorization': f'Bearer {token}' }) result = response.json() return result def get_email_by_token(self, token: str) -> Dict: - response = requests.get(f'{self.api_url}/users/emails', headers={ + response = requests.get(f'{self.api_url}/user/email/', headers={ 'Authorization': f'Bearer {token}' }) result = response.json()