class DefaultClientCredentialGranter implements ClientCredentialGranter {

    private final ReactiveAuthenticationManager authenticationManager;

    private final AccessTokenManager accessTokenManager;

    private final ApplicationEventPublisher eventPublisher;

    @Override
    public Mono<AccessToken> requestToken(ClientCredentialRequest request) {<FILL_FUNCTION_BODY>}
}


        OAuth2Client client = request.getClient();

        return authenticationManager
                .getByUserId(client.getUserId())
                .flatMap(auth -> accessTokenManager
                        .createAccessToken(client.getClientId(), auth, true)
                        .flatMap(token -> new OAuth2GrantedEvent(client,
                                                                 token,
                                                                 auth,
                                                                 "*",
                                                                 GrantType.client_credentials,
                                                                 request.getParameters())
                                .publish(eventPublisher)
                                .onErrorResume(err -> accessTokenManager
                                        .removeToken(client.getClientId(), token.getAccessToken())
                                        .then(Mono.error(err)))
                                .thenReturn(token))
                );
    
<no_super_class>