Beispiel #1
0
    def __init__(
        self,
        *,
        name: str,
        secret_key: str,
        backend: Type[SessionBackend],
        data_model: Type[BaseModel],
        scheme_name: Optional[str] = None,
        auto_error: bool = True,
        max_age: int = 14 * 24 * 60 * 60,  # 14 days in seconds
        expires: datetime = None,
        path: str = "/",
        domain: str = None,
        secure: bool = False,
        httponly: bool = True,
        samesite: str = "lax",
    ):
        self.model: APIKey = APIKey(**{"in": APIKeyIn.cookie}, name=name)
        self.scheme_name = scheme_name or self.__class__.__name__
        self.auto_error = auto_error

        self.signer = URLSafeTimedSerializer(secret_key, salt=name)
        self.backend = backend
        self.data_model = data_model

        self.max_age = max_age
        self.expires = expires
        self.path = path
        self.domain = domain
        self.secure = secure
        self.httponly = httponly
        self.samesite = samesite
Beispiel #2
0
 def __init__(self,
              *,
              name: str,
              scheme_name: Optional[str] = None,
              auto_error: bool = True):
     self.model: APIKey = APIKey(**{"in": APIKeyIn.cookie}, name=name)
     self.scheme_name = scheme_name or self.__class__.__name__
     self.auto_error = auto_error
Beispiel #3
0
 def __init__(self,
              *,
              name: str,
              scheme_name: str = None,
              auto_error: bool = True):
     self.model: APIKey = APIKey(**{"in": APIKeyIn.header}, name=name)
     self.scheme_name = scheme_name or self.__class__.__name__
     self.auto_error = auto_error
Beispiel #4
0
 def __init__(
     self,
     *,
     name: str,
     scheme_name: Optional[str] = None,
     description: Optional[str] = None,
 ):
     self.model: APIKey = APIKey(
         **{"in": APIKeyIn.header}, name=name, description=description
     )
     self.scheme_name = scheme_name or self.__class__.__name__
Beispiel #5
0
 def __init__(
     self,
     *,
     name: str,
     description: Optional[str] = None,
     scheme_name: Optional[str] = None,
     auto_error: bool = True
 ):
     self.model: APIKey = APIKey(
         **{"in": APIKeyIn.header}, name=name, description=description
     )
     self.scheme_name = scheme_name or self.__class__.__name__
     self.auto_error = auto_error
    def __init__(self,
                 *,
                 name: str,
                 verifier: Callable[[Any], Any],
                 decoder: Callable[[Any], Any],
                 scheme_name: str = None,
                 auto_error: bool = True):
        super().__init__(
            verifier=verifier,
            decoder=decoder,
            scheme_name=scheme_name,
            auto_error=auto_error,
        )

        self.model: APIKey = APIKey(**{"in": APIKeyIn.header}, name=name)
        self.getter = lambda x: x.headers
Beispiel #7
0
 def __init__(self, permissions: List):
     self.permissions = permissions
     self.model: APIKey = APIKey(**{"in": APIKeyIn.header},
                                 name="Authorization")
     self.scheme_name = self.__class__.__name__
Beispiel #8
0
 def __init__(self, *, name: str, scheme_name: str = None):
     self.model = APIKey(in_=APIKeyIn.cookie, name=name)
     self.scheme_name = scheme_name or self.__class__.__name__
Beispiel #9
0
 def __init__(self, *, name: str, scheme_name: str = None):
     self.model = APIKey(**{"in": APIKeyIn.header}, name=name)
     self.scheme_name = scheme_name or self.__class__.__name__