Class RequestAuthorizationService
java.lang.Object
org.qubership.atp.itf.lite.backend.service.RequestAuthorizationService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidencryptAuthorizationParameters(AuthorizationSaveRequest authorization) Encrypts authorization parameters using the appropriate strategy.generateAuthorizationHeader(RequestAuthorization authorization) Generates an authorization header for display.generateAuthorizationParams(RequestAuthorization authorization) Generates authorization parameters for display.parseAuthorizationFromMap(Map<String, String> auth, RequestAuthorizationType type) Parses authorization parameters from a Postman-style map.processRequestAuthorization(UUID projectId, HttpRequestEntitySaveRequest httpRequest, HttpRequestEntitySaveRequest httpHistoryRequest, UUID environmentId, org.qubership.atp.macros.core.processor.Evaluator evaluator, SaveRequestResolvingContext resolvingContext) Processes and applies authorization to the current request and its history copy.
-
Constructor Details
-
RequestAuthorizationService
public RequestAuthorizationService()
-
-
Method Details
-
processRequestAuthorization
public String processRequestAuthorization(UUID projectId, HttpRequestEntitySaveRequest httpRequest, HttpRequestEntitySaveRequest httpHistoryRequest, UUID environmentId, org.qubership.atp.macros.core.processor.Evaluator evaluator, SaveRequestResolvingContext resolvingContext) throws org.qubership.atp.crypt.exception.AtpDecryptException, com.fasterxml.jackson.core.JsonProcessingException Processes and applies authorization to the current request and its history copy. Applies unsafe token to the current request, safe token to the history request, and adds authorization parameters if available.- Parameters:
projectId- the project IDhttpRequest- the current requesthttpHistoryRequest- the historical copy of the requestenvironmentId- the environment IDevaluator- the evaluator for dynamic valuesresolvingContext- the context for resolving variables- Returns:
- the unsafe authorization token, or null if not available
- Throws:
org.qubership.atp.crypt.exception.AtpDecryptException- if decryption failscom.fasterxml.jackson.core.JsonProcessingException- if JSON processing fails
-
encryptAuthorizationParameters
Encrypts authorization parameters using the appropriate strategy.- Parameters:
authorization- the request authorization
-
parseAuthorizationFromMap
public RequestAuthorization parseAuthorizationFromMap(Map<String, String> auth, RequestAuthorizationType type) Parses authorization parameters from a Postman-style map.- Parameters:
auth- the map containing authorization datatype- the authorization type- Returns:
- the parsed request authorization
-
generateAuthorizationHeader
Generates an authorization header for display.- Parameters:
authorization- the request authorization- Returns:
- the generated request header, or null if type is missing
-
generateAuthorizationParams
Generates authorization parameters for display.- Parameters:
authorization- the request authorization- Returns:
- the generated request parameters, or null if type is missing
-