@Test
        void verifyClientCredentialsWithPrivateJWT() throws Throwable {
            val key = EncodingUtils.generateJsonWebKey(512);
            val registeredService = getOidcRegisteredService(UUID.randomUUID().toString());
            registeredService.setEncryptIdToken(false);
            registeredService.setJwks(key);
            registeredService.setTokenEndpointAuthenticationMethod(OAuth20ClientAuthenticationMethods.PRIVATE_KEY_JWT.getType());
            val claims = getClaims(registeredService.getClientId(),
                oidcIssuerService.determineIssuer(Optional.of(registeredService)),
                registeredService.getClientId(), registeredService.getClientId());
            registeredService.setSupportedGrantTypes(Set.of(OAuth20GrantTypes.CLIENT_CREDENTIALS.getType()));
            servicesManager.save(registeredService);

            val jwt = new String(EncodingUtils.signJwsHMACSha512(new AesKey(key.getBytes(StandardCharsets.UTF_8)),
                claims.toJson().getBytes(StandardCharsets.UTF_8), Map.of()), StandardCharsets.UTF_8);

            mvc.perform(post("/cas/" + OidcConstants.BASE_OIDC_URL + '/' + OidcConstants.ACCESS_TOKEN_URL)
                    .secure(true)
                    .queryParam(OAuth20Constants.CLIENT_ID, registeredService.getClientId())
                    .queryParam(OAuth20Constants.CLIENT_ASSERTION_TYPE, OAuth20Constants.CLIENT_ASSERTION_TYPE_JWT_BEARER)
                    .queryParam(OAuth20Constants.CLIENT_ASSERTION, jwt)
                    .queryParam(OAuth20Constants.GRANT_TYPE, OAuth20GrantTypes.CLIENT_CREDENTIALS.name()))
                .andExpect(status().isOk())
                .andExpect(jsonPath("$.access_token").exists())
                .andReturn();
        }
This is {@link OidcAccessTokenEndpointControllerTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-oidc/src/test/java/org/apereo/cas/oidc/web/controllers/token/OidcAccessTokenEndpointControllerTests.java