Class RequestAuthorizationService

java.lang.Object
org.qubership.atp.itf.lite.backend.service.RequestAuthorizationService

@Service public class RequestAuthorizationService extends Object
  • 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 ID
      httpRequest - the current request
      httpHistoryRequest - the historical copy of the request
      environmentId - the environment ID
      evaluator - the evaluator for dynamic values
      resolvingContext - the context for resolving variables
      Returns:
      the unsafe authorization token, or null if not available
      Throws:
      org.qubership.atp.crypt.exception.AtpDecryptException - if decryption fails
      com.fasterxml.jackson.core.JsonProcessingException - if JSON processing fails
    • encryptAuthorizationParameters

      public void encryptAuthorizationParameters(AuthorizationSaveRequest authorization)
      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 data
      type - the authorization type
      Returns:
      the parsed request authorization
    • generateAuthorizationHeader

      @Nullable public RequestHeader generateAuthorizationHeader(RequestAuthorization authorization)
      Generates an authorization header for display.
      Parameters:
      authorization - the request authorization
      Returns:
      the generated request header, or null if type is missing
    • generateAuthorizationParams

      @Nullable public List<RequestParam> generateAuthorizationParams(RequestAuthorization authorization)
      Generates authorization parameters for display.
      Parameters:
      authorization - the request authorization
      Returns:
      the generated request parameters, or null if type is missing