(self, request, token: str, get_token_details)
| 305 | return 'id' in auth_details and auth_details.get('type') == AuthenticationType.SYSTEM_USER.value |
| 306 | |
| 307 | def handle(self, request, token: str, get_token_details): |
| 308 | version, get_key = Cache_Version.TOKEN.value |
| 309 | cache_token = cache.get(get_key(token), version=version) |
| 310 | if cache_token is None: |
| 311 | raise AppAuthenticationFailed(1002, _('Login expired')) |
| 312 | auth_details = get_token_details() |
| 313 | timeout = CONFIG.get_session_timeout() |
| 314 | cache.touch(token, timeout=timeout, version=version) |
| 315 | user = QuerySet(User).get(id=auth_details['id']) |
| 316 | if not user.is_active or user.password != cache_token.password: |
| 317 | raise AppAuthenticationFailed(1002, _('Authentication information is incorrect')) |
| 318 | auth = get_auth(user) |
| 319 | return user, auth |
no test coverage detected