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)
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)
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)
def __init__(self): super(JWTScheme, self).__init__( auto_error=False, flows=OAuthFlows(password=OAuthFlowPassword( tokenUrl="/api/oauth2/ropcf")), )