### Question:
OidcUtils { public static void validatePrimaryJwtTokenType(OidcTenantConfig.Token tokenConfig, JsonObject tokenJson) { if (tokenJson.containsKey("typ")) { String type = tokenJson.getString("typ"); if (tokenConfig.getTokenType().isPresent() && !tokenConfig.getTokenType().get().equals(type)) { throw new OIDCException("Invalid token type"); } else if ("Refresh".equals(type)) { throw new OIDCException("Refresh token can only be used with the refresh token grant"); } } } private  OidcUtils(); static boolean isOpaqueToken(String token); static JsonObject decodeJwtContent(String jwt); static boolean validateClaims(OidcTenantConfig.Token tokenConfig, JsonObject json); static List<String> findRoles(String clientId, OidcTenantConfig.Roles rolesConfig, JsonObject json); static void setSecurityIdentityRoles(QuarkusSecurityIdentity.Builder builder, OidcTenantConfig config,
            JsonObject rolesJson); static void setBlockinApiAttribute(QuarkusSecurityIdentity.Builder builder, RoutingContext vertxContext); static void setTenantIdAttribute(QuarkusSecurityIdentity.Builder builder, OidcTenantConfig config); static void setSecurityIdentityUserInfo(QuarkusSecurityIdentity.Builder builder, JsonObject userInfo); static void validatePrimaryJwtTokenType(OidcTenantConfig.Token tokenConfig, JsonObject tokenJson);  }### Answer:
@Test public void testCorrectTokenType() throws Exception { OidcTenantConfig.Token tokenClaims = new OidcTenantConfig.Token(); tokenClaims.setTokenType("access_token"); JsonObject json = new JsonObject(); json.put("typ", "access_token"); OidcUtils.validatePrimaryJwtTokenType(tokenClaims, json); }
@Test public void testWrongTokenType() throws Exception { OidcTenantConfig.Token tokenClaims = new OidcTenantConfig.Token(); tokenClaims.setTokenType("access_token"); JsonObject json = new JsonObject(); json.put("typ", "refresh_token"); try { OidcUtils.validatePrimaryJwtTokenType(tokenClaims, json); fail("Exception expected: wrong token type"); } catch (OIDCException ex) { } }
@Test public void testKeycloakRefreshTokenType() throws Exception { JsonObject json = new JsonObject(); json.put("typ", "Refresh"); try { OidcUtils.validatePrimaryJwtTokenType(new OidcTenantConfig.Token(), json); fail("Exception expected: wrong token type"); } catch (OIDCException ex) { } }