Skip to content

Commit

Permalink
feat: add support for multiple userpool client_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
markomirosavljev committed Dec 22, 2022
1 parent 595c1c8 commit 06e169c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ All fields shown in example below, are also required in .json or .yaml file
You should also import BaseSettings from pydantic if you are going to use global BaseSettings object.
* Provide settings that are mandatory for CognitoAuth to work. You can provide
one or more userpools.
* `app_client_id` field for userpool besides string, can contain multiple string values provided within
list, tuple or set

```python
from pydantic import BaseSettings
Expand All @@ -48,7 +50,7 @@ class Settings(BaseSettings):
"eu": {
"region": "USERPOOL_REGION",
"userpool_id": "USERPOOL_ID",
"app_client_id": "APP_CLIENT_ID"
"app_client_id": ["APP_CLIENT_ID_1", "APP_CLIENT_ID_2"] # Example with multiple ids
},
"us": {
"region": "USERPOOL_REGION",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ certifi==2020.12.5
cffi==1.15.0
chardet==4.0.0
click==8.0.3
cognitojwt==1.2.2
cognitojwt==1.4.1
colorama==0.4.4
commonmark==0.9.1
cryptography==35.0.0
Expand Down
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="fastapi-cognito",
version="2.2.1",
version="2.3.0",
author="Marko Mirosavljev",
author_email="mirosavljevm023@gmail.com",
description="Basic AWS cognito authentication package for FastAPI",
Expand All @@ -24,8 +24,10 @@
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
py_modules=["fastapi_cognito"],
install_requires=["fastapi",
"cognitojwt[sync]",
"pyYAML"],
install_requires=[
"fastapi",
"cognitojwt[sync]==1.4.1",
"pyYAML"
],
python_requires=">=3.8",
)
4 changes: 2 additions & 2 deletions src/fastapi_cognito/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Union, Dict, List, Set, Any, Optional
from typing import Union, List, Set, Optional, Tuple

from pydantic import BaseModel, HttpUrl, Field


class UserpoolModel(BaseModel):
region: str
userpool_id: str
app_client_id: Union[str, List[str], Set[str], Dict[str, Any]]
app_client_id: Union[str, List[str], Set[str], Tuple[str]]


class CognitoToken(BaseModel):
Expand Down

0 comments on commit 06e169c

Please sign in to comment.