I want to customize the default_user_authentication_rule used by simple jwt authentication.
The usual process it follows is that it checks if the user account it has received the credentials is active or not. If is_active is true then it goes on with the authentication, else it throws the Unauthorised error.
I want to customise this function so that I get the Unauthorised error only when the user account does not exist at all or the credentials are invalid. If the user exists and is_active = False I want to return something like not-active so I can do something with it I have planned.
Please suggest to me what should I do as I have found no documentation regarding the same. Below is the Simple JWT settings
Update
What I wanted basically to get a different error code and message for inactive accounts.
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(seconds=3),
'REFRESH_TOKEN_LIFETIME': timedelta(days=7),
'ROTATE_REFRESH_TOKENS': True,
'BLACKLIST_AFTER_ROTATION': True,
'UPDATE_LAST_LOGIN': False,
'ALGORITHM': 'HS256',
'SIGNING_KEY': SECRET_KEY,
'VERIFYING_KEY': None,
'AUDIENCE': None,
'ISSUER': None,
'JWK_URL': None,
'LEEWAY': 0,
'AUTH_HEADER_TYPES': ('Bearer',),
'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION',
'USER_ID_FIELD': 'id',
'USER_ID_CLAIM': 'user_id',
'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule', # this is what I was talking about
'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),
'TOKEN_TYPE_CLAIM': 'token_type',
'TOKEN_USER_CLASS': 'rest_framework_simplejwt.models.TokenUser',
'JTI_CLAIM': 'jti',
'SLIDING_TOKEN_REFRESH_EXP_CLAIM': 'refresh_exp',
'SLIDING_TOKEN_LIFETIME': timedelta(minutes=5),
'SLIDING_TOKEN_REFRESH_LIFETIME': timedelta(days=1),
}