Class HttpSecurityUtils

java.lang.Object
io.quarkus.vertx.http.runtime.security.HttpSecurityUtils

public final class HttpSecurityUtils extends Object
  • Field Details

  • Method Details

    • pathWithoutMatrixParams

      public static String pathWithoutMatrixParams(String path)
      Removes matrix parameters from the path.

      The path may contain one or more path segments separated by a forward slash `/`. Each path segment may contain matrix parameters that are separated from the path value by a semicolon ';' character.

      When the current path segment contains a semicolon ';', it has all its data removed starting from this semicolon character.

      For example, passing both `/a;/b;` and `/a;a1=1;a2=2/b;b1=1;b2=2` paths to this function produces the `/a/b` path.

      Parameters:
      path - the path that may contain matrix parameters.
      Returns:
      the path without the matrix parameters.
    • normalizePath

      public static String normalizePath(String path)
      Fully normalizes a request path to its canonical form, closing the gap between the security layer's partial decoding and downstream handlers' full decoding.

      Transformations applied in order:

      1. Fully decode percent-encoded characters (loop handles double/triple encoding)
      2. Strip matrix parameters — after decoding so that encoded semicolons (%3B) are caught
      3. Remove null bytes
      4. Normalize backslashes to forward slashes
      5. Resolve dot segments (. and ..)
      Parameters:
      path - the path from RoutingContext.normalizedPath()
      Returns:
      the fully normalized path
    • getSecurityIdentities

      public static Map<String,io.quarkus.security.identity.SecurityIdentity> getSecurityIdentities(io.quarkus.security.identity.SecurityIdentity identity)
      Provides all the SecurityIdentity created by the inclusive authentication.
      Returns:
      null if RoutingContext is not available or getSecurityIdentities(RoutingContext)
      See Also:
    • getSecurityIdentities

      public static Map<String,io.quarkus.security.identity.SecurityIdentity> getSecurityIdentities(io.vertx.ext.web.RoutingContext routingContext)
      When inclusive authentication is enabled, we allow all authentication mechanisms to produce identity. However, only the first identity (provided by applicable mechanism with the highest priority) is stored in the CDI container. Therefore, we put all the identities into the RoutingContext.
      Returns:
      null if no identities were found or map with authentication mechanism key and security identity value
    • setRoutingContextAttribute

      public static io.quarkus.security.identity.request.AuthenticationRequest setRoutingContextAttribute(io.quarkus.security.identity.request.AuthenticationRequest request, io.vertx.ext.web.RoutingContext context)
    • getRoutingContextAttribute

      public static io.vertx.ext.web.RoutingContext getRoutingContextAttribute(io.quarkus.security.identity.request.AuthenticationRequest request)
    • getRoutingContextAttribute

      public static io.vertx.ext.web.RoutingContext getRoutingContextAttribute(io.quarkus.security.identity.SecurityIdentity identity)
    • getRoutingContextAttribute

      public static io.vertx.ext.web.RoutingContext getRoutingContextAttribute(Map<String,Object> authenticationRequestAttributes)
    • getCommonName

      public static String getCommonName(X500Principal principal)
    • getRdnValue

      static String getRdnValue(X500Principal principal, String rdnType)
    • addAuthenticationFailureToEvent

      public static void addAuthenticationFailureToEvent(io.quarkus.security.AuthenticationFailedException exception, io.vertx.ext.web.RoutingContext routingContext)
      Adds AuthenticationFailedException failure to the current RoutingContext. Main motivation is to have AuthenticationFailedException.getAttributes() available during challenge.
    • getAuthenticationFailureFromEvent

      public static io.quarkus.security.AuthenticationFailedException getAuthenticationFailureFromEvent(io.vertx.ext.web.RoutingContext routingContext)
    • getDefaultAuthConfig

      public static DefaultAuthConfig getDefaultAuthConfig()