def identify(self, request): token = self.get_token(request) if token is None or not self.token_is_valid( token, self.encryption_key ): return NO_IDENTITY return Identity('Testuser')
def log_in(self, request): response = Response() generic.remember_identity(response, request, Identity(userid='user', payload='Amazing'), lookup=request.lookup) return response
def default(self, request): # will not actually do anything as it's a no-op for basic # auth, but at least won't crash response = Response() generic.remember_identity(response, request, Identity('foo'), lookup=request.lookup) return response
def identify(self, request): """Establish claimed identity using request. :param request: Request to extract identity information from. :type request: :class:`morepath.Request`. :returns: :class:`morepath.security.Identity` instance. """ if Users.no_auth: return Identity(userid='anonymous', sessionId='') try: authorization = request.authorization except ValueError: return None if authorization is None: return None authtype, params = authorization auth = parse_auth(authtype, params) if auth is None: return None return Identity(userid=auth.username, sessionId=auth.sessionId)
def identify(self, request): return Identity('testidentity')
def identify(self, request): data = request.cookies.get('dumb_id', None) if data is None: return NO_IDENTITY data = json.loads(base64.b64decode(data).decode()) return Identity(**data)