Where can I find HalOAuth2RestTemplate class

Hi,

In thread
Audience not supported in Spring's @EnableOAuth2Client,

there is a code snipet that uses HalOAuth2RestTemplate. But I cannot find any package that contains the class. Where can I find that class?

Here is “my version” of this problem. An only with the post from ish was I able to solve.
But he had a (unknown) class.

import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest;
import org.springframework.security.oauth2.client.token.DefaultRequestEnhancer;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsAccessTokenProvider;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;

public OAuth2RestTemplate generateOAuth2RestTemplate(final String clientId, final char secret, final String accessTokenUrl, final String grantType, final Map<String, String> requestParameters) {

    ClientCredentialsResourceDetails details = new ClientCredentialsResourceDetails();
    details.setClientId(clientId);

    StringBuilder sb = new StringBuilder();
    if (null != secret) {
        for (char ch : secret) {
            sb.append(ch);
        }
    }

    /* sadly, the setter for the secret is only available as string :<  https://docs.spring.io/spring-security/oauth/apidocs/org/springframework/security/oauth2/client/resource/BaseOAuth2ProtectedResourceDetails.html#setClientSecret(java.lang.String) */
    details.setClientSecret(sb.toString());

    /* destroy the StringBuilder */
    sb.setLength(0);
    for (char c : UUID.randomUUID().toString().toCharArray()) {
        sb.append(c);
    }
    sb = null;

    details.setAccessTokenUri(accessTokenUrl);

    if (null != grantType) {
        /* watch for the default grant-type in the ClientCredentialsResourceDetails object */
        details.setGrantType(grantType);
    }

    DefaultAccessTokenRequest datr = new DefaultAccessTokenRequest();

    if (null != requestParameters && !requestParameters.isEmpty()) {
        datr.setAll(requestParameters);
    }

    //Create a RequestEnhancer that have the same requestParameters KEYS as the input requestParameters.
    DefaultRequestEnhancer dre = new DefaultRequestEnhancer();
    if (null != requestParameters && !requestParameters.isEmpty()) {
        requestParameters.forEach((k, v) -> {
            dre.setParameterIncludes(requestParameters.keySet());
        });
    }

    //Create a new Token Provider
    ClientCredentialsAccessTokenProvider clientCredentialsAccessTokenProvider = new ClientCredentialsAccessTokenProvider();
    //now set the enhancer, using the above DefaultRequestEnhancer
    clientCredentialsAccessTokenProvider.setTokenRequestEnhancer(dre);

    OAuth2RestTemplate template = new OAuth2RestTemplate(details, new DefaultOAuth2ClientContext(datr));
    template.setAccessTokenProvider(clientCredentialsAccessTokenProvider);

    return new template;
}