Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 3353c74

Browse files
committed
Added IDP REGION setting
1 parent fa9d6e3 commit 3353c74

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ REST_FRAMEWORK_MICROSERVICE = {
114114
"REFRESH_COOKIE_PATH": "/auth",
115115
"IDP": {
116116
"PROVIDER": "aws",
117+
"REGION": "us-west-2",
117118
"USER_POOL": "us-west-2_abcdefg",
118119
"CLIENT_ID": "abcdefg",
119120
},
@@ -140,6 +141,7 @@ needs to match the path of authentication endpoint path set in urls.py.
140141
A dictionary containing IDP attributes:
141142
- ``PROVIDER``: a string identifying what IDP backend to use, defaults to `'aws'`
142143
(Currently only AWS Cognito is supported.)
144+
- ``REGION``: user pool region.
143145
- ``USER_POOL``: user pool identifier used with the IDP.
144146
- ``CLIENT_ID``: IDP client id for your application.
145147

rest_framework_microservice/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"REFRESH_COOKIE_PATH": "/auth",
1010
"IDP": {
1111
"PROVIDER": "aws",
12+
"REGION": "us-west-2",
1213
"USER_POOL": "us-west-2_abcdefg",
1314
"CLIENT_ID": "abcdefg",
1415
},

rest_framework_microservice/social_auth/aws_cognito.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_pub_keys():
2121

2222
if pub_keys is None:
2323
pub_keys = {key['kid']: json.dumps(key) for key in requests.get(
24-
f"https://cognito-idp.us-west-2.amazonaws.com/{rest_microservice_settings.IDP['USER_POOL']}/.well-known/jwks.json").json().get('keys')}
24+
f"https://cognito-idp.{rest_microservice_settings.IDP['REGION']}.amazonaws.com/{rest_microservice_settings.IDP['USER_POOL']}/.well-known/jwks.json").json().get('keys')}
2525
cache.set('cognito_pub_keys', pub_keys, 86000)
2626

2727
return pub_keys

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = django-rest-microservice
3-
version = 1.0.2
3+
version = 1.0.3
44
description = Facilitating microservice architecture in Django REST framework
55
long_description = file: README.md
66
url = https://github.com/oscarychen/django-rest-microservice

0 commit comments

Comments
 (0)