def identify(self, request):
     user = request.headers.get('user', None)
     if user is not None:
         if user == '':
             return Anonymous()
         return Identity(userid=user,
                         password=request.headers['password'])
Beispiel #2
0
 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")
Beispiel #3
0
 def identify(self, request):
     user = request.headers.get("user", None)
     if user is not None:
         if user == "":
             return Anonymous()
         return Identity(
             userid=user, password=request.headers["password"]
         )
Beispiel #4
0
 def log_in(self, request):
     response = Response()
     with pytest.deprecated_call():
         generic.remember_identity(response,
                                   request,
                                   Identity(userid='user',
                                            payload='Amazing'),
                                   lookup=request.lookup)
     return response
Beispiel #5
0
 def identify(self, request):
     return Identity("testidentity")
Beispiel #6
0
 def log_in(self, request):
     response = Response()
     request.app.remember_identity(
         response, request, Identity(userid="user", payload="Amazing")
     )
     return response
Beispiel #7
0
 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)
Beispiel #8
0
 def identify(self, request):
     return Identity('testidentity')