notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/ssp/SSPApi.java
private synchronized SSPToken getAuthenticationToken(boolean forceUpdate) throws MalformedURLException, RestClientException {
        if (authenticationToken != null && !authenticationToken.hasExpired() && !forceUpdate) {
            return authenticationToken;
        }

        String authString = getClientId() + ":" + getClientSecret();
        String authentication = new Base64().encodeToString(authString.getBytes());

        HttpHeaders headers = new HttpHeaders();
        headers.add(AUTHORIZATION, BASIC + " " + authentication);

        // form encode the grant_type...
        MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
        form.add(GRANT_TYPE, CLIENT_CREDENTIALS);

        HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(form, headers);

        URL authURL = getAuthenticationURL();
        authenticationToken = restTemplate.postForObject(authURL.toExternalForm(), request, SSPToken.class);
        return authenticationToken;
    }
private synchronized SSPToken getAuthenticationToken(boolean forceUpdate) throws MalformedURLException, RestClientException {
        if (authenticationToken != null && !authenticationToken.hasExpired() && !forceUpdate) {
            return authenticationToken;
        }

        String authString = getClientId() + ":" + getClientSecret();
        String authentication = new Base64().encodeToString(authString.getBytes());

        HttpHeaders headers = new HttpHeaders();
        headers.add(AUTHORIZATION, BASIC + " " + authentication);

        // form encode the grant_type...
        MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
        form.add(GRANT_TYPE, CLIENT_CREDENTIALS);

        HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(form, headers);

        URL authURL = getAuthenticationURL();
        authenticationToken = restTemplate.postForObject(authURL.toExternalForm(), request, SSPToken.class);
        return authenticationToken;
    }
private synchronized SSPToken getAuthenticationToken ( boolean forceUpdate ) throws MalformedURLException , RestClientException { if ( authenticationToken != null && ! authenticationToken . hasExpired ( ) && ! forceUpdate ) { return authenticationToken ; } String authString = getClientId ( ) + ":" + getClientSecret ( ) ; String authentication = new Base64 ( ) . encodeToString ( authString . getBytes ( ) ) ; HttpHeaders headers = new HttpHeaders ( ) ; headers . add ( AUTHORIZATION , BASIC + " " + authentication ) ; // form encode the grant_type... MultiValueMap < String , String > form = new LinkedMultiValueMap <> ( ) ; form . add ( GRANT_TYPE , CLIENT_CREDENTIALS ) ; HttpEntity < MultiValueMap < String , String > > request = new HttpEntity <> ( form , headers ) ; URL authURL = getAuthenticationURL ( ) ; authenticationToken = restTemplate . postForObject ( authURL . toExternalForm ( ) , request , SSPToken . class ) ; return authenticationToken ; }
Get the authentication token to use.

@param forceUpdate if true, get a new auth token even if a cached instance exists.
@return The authentication token
@throws MalformedURLException if the authentication URL is invalid
@throws RestClientException if an error occurs when talking to SSP
Get the authentication token to use .