Exemple #1
0
 def endpoint(auth: Auth() = Depends()):
     return auth.token is not None
Exemple #2
0
 def endpoint(auth: Auth(required=True) = Depends()):
     return auth.token is not None
Exemple #3
0
def test_check_has():
    assert Auth()._check_has({'has1', 'has2'}, ['has1', ('has2', 'has3')])
    assert not Auth()._check_has({'has1', 'has2'}, ['has1', ('has3', 'has4')])
    assert not Auth()._check_has({'has1', 'has2'}, ['has1', 'has3'])
    assert not Auth()._check_has(set(), ['has1', 'has3'])
Exemple #4
0
 def endpoint(auth: Auth(token_type='refresh') = Depends()):
     return auth.token is not None
Exemple #5
0
 def endpoint(auth: Auth(required=True,
                         abilities=['auth']) = Depends()) -> str:
     return True
Exemple #6
0
 def endpoint(auth: Auth(required=True, roles=['user']) = Depends()) -> str:
     return True
Exemple #7
0
 def endpoint(auth: Auth(required=True,
                         abilities=['auth',
                                    ('read', 'write')]) = Depends()) -> str:
     return True
Exemple #8
0
 def endpoint(auth: Auth(required=True,
                         roles=['user', ('admin', 'super-admin')
                                ]) = Depends()) -> str:
     return True
Exemple #9
0
 def endpoint(request: Request) -> str:
     return Auth()._get_credential_cookie(request)
Exemple #10
0
 def endpoint(authorization: str = Header(None)) -> str:
     return Auth()._get_credential_header(authorization)
Exemple #11
0
 def endpoint(request: Request, authorization: str = Header(None)) -> str:
     return Auth()._get_credential(request, authorization)