Skip to content

Commit

Permalink
Merge pull request teamhephy#56 from jianxiaoguo/main
Browse files Browse the repository at this point in the history
chore(oauth): modify passport api
  • Loading branch information
duanhongyi authored Aug 13, 2021
2 parents cf43590 + cad913c commit 009d27b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions charts/controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ 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"
value: "$(DRYCC_PASSPORT_DOMAIN)/oauth/.well-known/jwks.json"
- 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:
Expand Down
2 changes: 1 addition & 1 deletion rootfs/api/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
4 changes: 2 additions & 2 deletions rootfs/api/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 009d27b

Please sign in to comment.