@ -64,7 +64,7 @@ def IdentifyAuthorize(inRequest:Request, inResponse:Response,
mOpenRPA [ " Domain " ] = lResult [ " Domain " ]
mOpenRPA [ " User " ] = lResult [ " User " ]
mOpenRPA [ " IsSuperToken " ] = __Orchestrator__ . GSettingsGet ( ) . get ( " ServerDict " , { } ) . get ( " AccessUsers " , { } ) . get ( " AuthTokensDict " , { } ) . get ( mOpenRPA [ " AuthToken " ] , { } ) . get ( " FlagDoNotExpire " , False )
return mOpenRPA
return lAuthToken
######################################
#Way 2 - try to logon
if len ( lHeaderAuthorization ) == 2 :
@ -95,15 +95,15 @@ def IdentifyAuthorize(inRequest:Request, inResponse:Response,
mOpenRPA [ " Domain " ] = lResult [ " Domain " ]
mOpenRPA [ " User " ] = lResult [ " User " ]
mOpenRPA [ " IsSuperToken " ] = __Orchestrator__ . GSettingsGet ( ) . get ( " ServerDict " , { } ) . get ( " AccessUsers " , { } ) . get ( " AuthTokensDict " , { } ) . get ( mOpenRPA [ " AuthToken " ] , { } ) . get ( " FlagDoNotExpire " , False )
return mOpenRPA
return lAuthToken
#inRequest.OpenRPASetCookie = {}
#New engine of server
#inRequest.OpenRPAResponseDict["SetCookies"]["AuthToken"] = lAuthToken
else :
raise HTTPException ( status_code = 401 , detail = " here is the details " , headers = { } )
raise HTTPException ( status_code = 401 , detail = " Попытка авторизации не прошла успешно (неверная пара логин / пароль) " , headers = { } )
######################################
else :
raise HTTPException ( status_code = 401 , detail = " here is the details " , headers = { ' Content-type ' : ' text/html ' , ' WWW-Authenticate ' : ' Basic ' } )
raise HTTPException ( status_code = 401 , detail = " Попытка авторизации не прошла успешно (неполная пара логин / пароль) " , headers = { ' Content-type ' : ' text/html ' , ' WWW-Authenticate ' : ' Basic ' } )
lRouteList = [ ]
for lItem in app . router . routes :
@ -118,8 +118,8 @@ for lItem in lRouteList:
tags = [ " FastAPI " ]
)
def BackwardCompatibility ( inRequest : Request , inResponse : Response , inBodyStr : str = Body ( " " ) , inAuth Dict = None ) :
lHTTPRequest = ServerBC . HTTPRequestOld ( inRequest = inRequest , inResponse = inResponse , inAuth Dict= inAuthDict )
def BackwardCompatibility ( inRequest : Request , inResponse : Response , inBodyStr : str = Body ( " " ) , inAuth TokenStr = None ) :
lHTTPRequest = ServerBC . HTTPRequestOld ( inRequest = inRequest , inResponse = inResponse , inAuth TokenStr= inAuthTokenStr )
lHTTPRequest . path = inRequest . url . path
lHTTPRequest . body = inBodyStr
lHTTPRequest . client_address = [ inRequest . client . host ]
@ -132,13 +132,13 @@ def BackwardCompatibility(inRequest:Request, inResponse:Response, inBodyStr:str
#WRAPPERS!
def BackwardCompatibityWrapperAuth ( inRequest : Request , inResponse : Response , inBodyStr : str = Body ( " " ) ,
inAuth Dict: dict = Depends ( IdentifyAuthorize ) ) : # Old from v1.3.1 (updated to FastAPI)
return BackwardCompatibility ( inRequest = inRequest , inResponse = inResponse , inBodyStr = inBodyStr , inAuth Dict= inAuthDict )
inAuth TokenStr: str = Depends ( IdentifyAuthorize ) ) : # Old from v1.3.1 (updated to FastAPI)
return BackwardCompatibility ( inRequest = inRequest , inResponse = inResponse , inBodyStr = inBodyStr , inAuth TokenStr= inAuthTokenStr )
def BackwardCompatibityWrapperNoAuth ( inRequest : Request , inResponse : Response , inBodyStr : str = Body ( " " ) ) : # Old from v1.3.1 (updated to FastAPI)
return BackwardCompatibility ( inRequest = inRequest , inResponse = inResponse , inBodyStr = inBodyStr , inAuthDict = None )
def BackwardCompatibityBeginWrapperAuth ( inBeginTokenStr , inRequest : Request , inResponse : Response , inBodyStr : str = Body ( " " ) ,
inAuth Dict: dict = Depends ( IdentifyAuthorize ) ) : # Old from v1.3.1 (updated to FastAPI)
return BackwardCompatibility ( inRequest = inRequest , inResponse = inResponse , inBodyStr = inBodyStr , inAuth Dict= inAuthDict )
inAuth TokenStr: str = Depends ( IdentifyAuthorize ) ) : # Old from v1.3.1 (updated to FastAPI)
return BackwardCompatibility ( inRequest = inRequest , inResponse = inResponse , inBodyStr = inBodyStr , inAuth TokenStr= inAuthTokenStr )
def BackwardCompatibityBeginWrapperNoAuth ( inBeginTokenStr , inRequest : Request , inResponse : Response , inBodyStr : str = Body ( " " ) ) : # Old from v1.3.1 (updated to FastAPI)
return BackwardCompatibility ( inRequest = inRequest , inResponse = inResponse , inBodyStr = inBodyStr , inAuthDict = None )