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