Class OidcUtils

java.lang.Object
io.quarkus.oidc.runtime.OidcUtils

public final class OidcUtils extends Object
  • Field Details

  • Method Details

    • getSessionCookie

      public static String getSessionCookie(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcTenantConfig)
    • getSessionCookie

      public static String getSessionCookie(Map<String,Object> context, Map<String,io.vertx.core.http.Cookie> cookies, OidcTenantConfig oidcTenantConfig)
    • getSessionCookieName

      public static String getSessionCookieName(OidcTenantConfig oidcConfig)
    • getCookieSuffix

      public static String getCookieSuffix(OidcTenantConfig oidcConfig)
    • isServiceApp

      public static boolean isServiceApp(OidcTenantConfig oidcConfig)
    • isWebApp

      public static boolean isWebApp(OidcTenantConfig oidcConfig)
    • isEncryptedToken

      public static boolean isEncryptedToken(String token)
    • isOpaqueToken

      public static boolean isOpaqueToken(String token)
    • decodeJwtContent

      public static io.vertx.core.json.JsonObject decodeJwtContent(String jwt)
    • decodeJwtContentAsString

      public static String decodeJwtContentAsString(String jwt)
    • getJwtContentPart

      public static String getJwtContentPart(String jwt)
    • base64UrlDecode

      public static String base64UrlDecode(String encodedContent)
    • decodeJwtHeaders

      public static io.vertx.core.json.JsonObject decodeJwtHeaders(String jwt)
    • decodeJwtHeadersAsString

      public static String decodeJwtHeadersAsString(String jwt)
    • findRoles

      public static List<String> findRoles(String clientId, OidcTenantConfig.Roles rolesConfig, io.vertx.core.json.JsonObject json)
    • validateAndCreateIdentity

      static QuarkusSecurityIdentity validateAndCreateIdentity(Map<String,Object> requestData, io.quarkus.security.credential.TokenCredential credential, TenantConfigContext resolvedContext, io.vertx.core.json.JsonObject tokenJson, io.vertx.core.json.JsonObject rolesJson, UserInfo userInfo, TokenIntrospection introspectionResult, io.quarkus.security.identity.request.TokenAuthenticationRequest request)
    • setSecurityIdentityPermissions

      static void setSecurityIdentityPermissions(QuarkusSecurityIdentity.Builder builder, OidcTenantConfig config, io.vertx.core.json.JsonObject permissionsJson)
    • addTokenScopesAsPermissions

      static void addTokenScopesAsPermissions(QuarkusSecurityIdentity.Builder builder, Collection<String> scopes)
    • transformScopesToPermissions

      static Permission[] transformScopesToPermissions(Collection<String> scopes)
    • setSecurityIdentityRoles

      public static void setSecurityIdentityRoles(QuarkusSecurityIdentity.Builder builder, OidcTenantConfig config, io.vertx.core.json.JsonObject rolesJson)
    • setBlockingApiAttribute

      public static void setBlockingApiAttribute(QuarkusSecurityIdentity.Builder builder, io.vertx.ext.web.RoutingContext vertxContext)
    • setTenantIdAttribute

      public static void setTenantIdAttribute(QuarkusSecurityIdentity.Builder builder, OidcTenantConfig config)
    • setRoutingContextAttribute

      public static void setRoutingContextAttribute(QuarkusSecurityIdentity.Builder builder, io.vertx.ext.web.RoutingContext routingContext)
    • setSecurityIdentityUserInfo

      public static void setSecurityIdentityUserInfo(QuarkusSecurityIdentity.Builder builder, UserInfo userInfo)
    • setSecurityIdentityIntrospection

      public static void setSecurityIdentityIntrospection(QuarkusSecurityIdentity.Builder builder, TokenIntrospection introspectionResult)
    • setSecurityIdentityConfigMetadata

      public static void setSecurityIdentityConfigMetadata(QuarkusSecurityIdentity.Builder builder, TenantConfigContext resolvedContext)
    • validatePrimaryJwtTokenType

      public static void validatePrimaryJwtTokenType(OidcTenantConfig.Token tokenConfig, io.vertx.core.json.JsonObject tokenJson)
    • removeSessionCookie

      static io.smallrye.mutiny.Uni<Void> removeSessionCookie(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig, TokenStateManager tokenStateManager)
    • removeCookie

      public static String removeCookie(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig, String cookieName)
    • removeCookie

      static void removeCookie(io.vertx.ext.web.RoutingContext context, io.vertx.core.http.impl.ServerCookie cookie, OidcTenantConfig oidcConfig)
    • setCookiePath

      static void setCookiePath(io.vertx.ext.web.RoutingContext context, OidcTenantConfig.Authentication auth, io.vertx.core.http.impl.ServerCookie cookie)
    • mergeTenantConfig

      static OidcTenantConfig mergeTenantConfig(OidcTenantConfig tenant, OidcTenantConfig provider)
      Merge the current tenant and well-known OpenId Connect provider configurations. Initialized properties take priority over uninitialized properties. Initialized properties in the current tenant configuration take priority over the same initialized properties in the well-known OpenId Connect provider configuration. Tenant id property of the current tenant must be set before the merge operation.
      Parameters:
      tenant - current tenant configuration
      provider - well-known OpenId Connect provider configuration
      Returns:
      merged configuration
    • resolveProviderConfig

      static OidcTenantConfig resolveProviderConfig(OidcTenantConfig oidcTenantConfig)
    • getSha256Digest

      public static byte[] getSha256Digest(byte[] value) throws NoSuchAlgorithmException
      Throws:
      NoSuchAlgorithmException
    • encryptJson

      public static String encryptJson(io.vertx.core.json.JsonObject json, SecretKey key) throws Exception
      Throws:
      Exception
    • encryptString

      public static String encryptString(String jweString, SecretKey key) throws Exception
      Throws:
      Exception
    • encryptString

      public static String encryptString(String jweString, SecretKey key, io.smallrye.jwt.algorithm.KeyEncryptionAlgorithm algorithm) throws Exception
      Throws:
      Exception
    • decryptJson

      public static io.vertx.core.json.JsonObject decryptJson(String jweString, Key key) throws Exception
      Throws:
      Exception
    • decryptString

      public static String decryptString(String jweString, Key key) throws Exception
      Throws:
      Exception
    • decryptString

      public static String decryptString(String jweString, Key key, io.smallrye.jwt.algorithm.KeyEncryptionAlgorithm algorithm) throws org.jose4j.lang.JoseException
      Throws:
      org.jose4j.lang.JoseException
    • isFormUrlEncodedRequest

      public static boolean isFormUrlEncodedRequest(io.vertx.ext.web.RoutingContext context)
    • getFormUrlEncodedData

      public static io.smallrye.mutiny.Uni<io.vertx.core.MultiMap> getFormUrlEncodedData(io.vertx.ext.web.RoutingContext context)
    • encodeScopes

      public static String encodeScopes(OidcTenantConfig oidcConfig)
    • getAllScopes

      public static List<String> getAllScopes(OidcTenantConfig oidcConfig)
    • isSessionCookie

      public static boolean isSessionCookie(String cookieName)
    • extractBearerToken

      static String extractBearerToken(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig)
    • storeExtractedBearerToken

      static void storeExtractedBearerToken(io.vertx.ext.web.RoutingContext context, String token)
    • getTenantIdFromCookie

      public static String getTenantIdFromCookie(String cookiePrefix, String cookieName, boolean sessionCookie)
    • cacheUserInfoInIdToken

      public static boolean cacheUserInfoInIdToken(DefaultTenantConfigResolver resolver, OidcTenantConfig oidcConfig)
    • createCookie

      public static io.vertx.core.http.impl.ServerCookie createCookie(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig, String name, String value, long maxAge)
    • createSecretKeyFromDigest

      public static SecretKey createSecretKeyFromDigest(byte[] secretBytes)
    • getTokenCredential

      public static <T extends io.quarkus.security.credential.TokenCredential> T getTokenCredential(io.quarkus.security.identity.SecurityIdentity identity, Class<T> type)
    • getAttribute

      public static <T> T getAttribute(io.quarkus.security.identity.SecurityIdentity identity, String name)
    • isJwtTokenExpired

      public static boolean isJwtTokenExpired(String token)