protected Principal buildAuthenticatedPrincipal(final Principal resolvedPrincipal, final OAuthRegisteredService registeredService,
                                                    final WebApplicationService service, final CallContext callContext) throws Throwable {
        val accessTokenFactory = (OAuth20AccessTokenFactory) ticketFactory.get(OAuth20AccessToken.class);
        val scopes = requestParameterResolver.resolveRequestedScopes(callContext.webContext());
        val responseType = requestParameterResolver.resolveResponseType(callContext.webContext());
        val grantType = requestParameterResolver.resolveGrantType(callContext.webContext());

        val authentication = DefaultAuthenticationBuilder.newInstance(resolvedPrincipal).build();
        val accessToken = accessTokenFactory.create(service, authentication, scopes,
            registeredService.getClientId(), responseType, grantType);
        val finalPrincipal = profileScopeToAttributesFilter.filter(service, resolvedPrincipal, registeredService, accessToken);
        LOGGER.debug("Built final principal [{}]", finalPrincipal);
        return finalPrincipal;
    }
Authenticator for client credentials authentication.

@author Jerome Leleu
@since 5.0.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/authenticator/OAuth20ClientIdClientSecretAuthenticator.java