Class OidcUtils

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

public final class OidcUtils extends Object
  • Field Details

  • Method Details

    • decodeJwtContent

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

      public static String getJwtContentPart(String jwt)
    • 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)
    • getSessionCookie

      public static String getSessionCookie(Map<String,Object> context, Map<String,io.vertx.core.http.Cookie> cookies, OidcTenantConfig oidcTenantConfig, String defaultSessionCookieName, String sessionCookieName)
    • 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)
    • decodeJwtContentAsString

      public static String decodeJwtContentAsString(String jwt)
    • 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 io.quarkus.security.runtime.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)
    • setIntrospectionScopes

      static void setIntrospectionScopes(io.quarkus.security.runtime.QuarkusSecurityIdentity.Builder builder, TokenIntrospection introspectionResult)
    • setSecurityIdentityPermissions

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

      static void addTokenScopesAsPermissions(io.quarkus.security.runtime.QuarkusSecurityIdentity.Builder builder, Collection<String> scopes)
    • setSecurityIdentityRoles

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

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

      public static void setTenantIdAttribute(io.quarkus.security.runtime.QuarkusSecurityIdentity.Builder builder, OidcTenantConfig config)
    • setRoutingContextAttribute

      public static void setRoutingContextAttribute(io.quarkus.security.runtime.QuarkusSecurityIdentity.Builder builder, io.vertx.ext.web.RoutingContext routingContext)
    • setOidcProviderClientAttribute

      public static void setOidcProviderClientAttribute(io.quarkus.security.runtime.QuarkusSecurityIdentity.Builder builder, OidcProviderClient oidcProviderClient)
    • setSecurityIdentityUserInfo

      public static void setSecurityIdentityUserInfo(io.quarkus.security.runtime.QuarkusSecurityIdentity.Builder builder, UserInfo userInfo)
    • setSecurityIdentityIntrospection

      public static void setSecurityIdentityIntrospection(io.quarkus.security.runtime.QuarkusSecurityIdentity.Builder builder, TokenIntrospection introspectionResult)
    • setSecurityIdentityConfigMetadata

      public static void setSecurityIdentityConfigMetadata(io.quarkus.security.runtime.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(String value) throws NoSuchAlgorithmException
      Throws:
      NoSuchAlgorithmException
    • getSha256Digest

      public static byte[] getSha256Digest(String value, Charset charset) throws NoSuchAlgorithmException
      Throws:
      NoSuchAlgorithmException
    • 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, Key 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(String secretKey)
    • 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)
    • getJwtExpiresAtClaim

      static Long getJwtExpiresAtClaim(io.vertx.core.json.JsonObject claims)
    • isApplicationJwtContentType

      public static boolean isApplicationJwtContentType(String ct)
    • setClearSiteData

      public static void setClearSiteData(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig)
    • readDecryptionKey

      public static Key readDecryptionKey(String decryptionKeyLocation) throws Exception
      Throws:
      Exception
    • decryptToken

      public static String decryptToken(TenantConfigContext resolvedContext, String token)
    • isDPoPScheme

      public static boolean isDPoPScheme(String authorizationScheme)
    • getRootPath

      public static String getRootPath(String configuredRootPath)
    • getOidcRequestFilters

      public static Map<io.quarkus.oidc.common.OidcEndpoint.Type,List<io.quarkus.oidc.common.OidcRequestFilter>> getOidcRequestFilters(OidcTenantConfig oidcTenantConfig)
    • getOidcResponseFilters

      public static Map<io.quarkus.oidc.common.OidcEndpoint.Type,List<io.quarkus.oidc.common.OidcResponseFilter>> getOidcResponseFilters(OidcTenantConfig oidcTenantConfig)
    • createSessionCookie

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

      static void createChunkedCookie(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig, String baseCookieName, String cookieValue, long maxAge)
    • encryptToken

      public static String encryptToken(String token, io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig)
    • decryptToken

      public static String decryptToken(String token, io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig)
    • decryptTokens

      public static AuthorizationCodeTokens decryptTokens(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig, AuthorizationCodeTokens tokens)
    • encryptTokens

      public static AuthorizationCodeTokens encryptTokens(io.vertx.ext.web.RoutingContext context, OidcTenantConfig oidcConfig, AuthorizationCodeTokens tokens)
    • isParEnabled

      static boolean isParEnabled(OidcTenantConfig.Authentication authenticationConfig, OidcConfigurationMetadata metadata)