Esempio n. 1
0
 def __init__(self,
              host: str = "http://localhost",
              tokenUrl: str = "http://localhost/token"):
     super().__init__(host)
     self.auth_state = AuthState()
     flow = OAuthFlowPassword(tokenUrl=tokenUrl)
     auth_middleware = AuthMiddleware(auth_state=self.auth_state, flow=flow)
     self.add_middleware(auth_middleware)
Esempio n. 2
0
    def __init__(self, token_url: str,
                 scheme_name: Optional[str] = None,
                 scopes: Optional[dict] = None,
                 auto_error: bool = True):
        if scopes is None:
            scopes = {}

        flows = OAuthFlowsModel(password=OAuthFlowPassword(tokenUrl=token_url, scopes=scopes))
        super().__init__(flows=flows, scheme_name=scheme_name, auto_error=auto_error)
Esempio n. 3
0
 def __init__(
     self,
     token_url: str,
     refresh_url: str,
     scheme_name: str = None,
     scopes: Dict[str, str] = None,
     auto_error: bool = True,
 ):
     if not scopes:  # pragma: no cover
         scopes = {}
     flows = OAuthFlowsModel(password=OAuthFlowPassword(
         tokenUrl=token_url, refreshUrl=refresh_url, scopes=scopes))
     super(OAuth2PasswordBearer, self).__init__(flows=flows,
                                                scheme_name=scheme_name,
                                                auto_error=auto_error)
Esempio n. 4
0
 def __init__(self):
     super(JWTScheme, self).__init__(
         auto_error=False,
         flows=OAuthFlows(password=OAuthFlowPassword(
             tokenUrl="/api/oauth2/ropcf")),
     )