Skip to content

Customize settings#143

Open
martinxsliu wants to merge 1 commit into
eadwinCode:masterfrom
martinxsliu:ml/customize-settings
Open

Customize settings#143
martinxsliu wants to merge 1 commit into
eadwinCode:masterfrom
martinxsliu:ml/customize-settings

Conversation

@martinxsliu

Copy link
Copy Markdown

Add a class variable Token.settings which defaults to api_settings. This allows users to define multiple Token classes with different settings, e.g. in cases where we may want to validate against multiple token types.

@eadwinCode eadwinCode left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also failing tests

Comment thread ninja_jwt/tokens.py
token_type: Optional[str] = None
lifetime: Optional[datetime] = None
lifetime: Optional[timedelta] = None
settings: NinjaJWTSettings = api_settings

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings is better off a property than a cls attribute

@property
def ninja_jwt_setting(self) -> NinjaJWTSettings:
    return api_settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants