clean up code format
parent
671ea4d816
commit
cd711a8ac6
|
@ -249,26 +249,27 @@ public class OIDCAuthenticationFilter extends AbstractAuthenticationProcessingFi
|
||||||
|
|
||||||
RestTemplate restTemplate;
|
RestTemplate restTemplate;
|
||||||
|
|
||||||
if(clientConfig instanceof ClientDetailsEntity && SECRET_BASIC.equals(((ClientDetailsEntity) clientConfig).getTokenEndpointAuthMethod())){
|
if (clientConfig instanceof ClientDetailsEntity && SECRET_BASIC.equals(((ClientDetailsEntity) clientConfig).getTokenEndpointAuthMethod())){
|
||||||
restTemplate = new RestTemplate(factory){
|
// use BASIC auth if configured to do so
|
||||||
|
restTemplate = new RestTemplate(factory) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
|
protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
|
||||||
ClientHttpRequest httpRequest = super.createRequest(url, method);
|
ClientHttpRequest httpRequest = super.createRequest(url, method);
|
||||||
httpRequest.getHeaders().add("Authorization",
|
httpRequest.getHeaders().add("Authorization",
|
||||||
String.format("Basic %s", Base64.encode(String.format("%s:%s", clientConfig.getClientId(), clientConfig.getClientSecret())) ));
|
String.format("Basic %s", Base64.encode(String.format("%s:%s", clientConfig.getClientId(), clientConfig.getClientSecret())) ));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return httpRequest;
|
return httpRequest;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}else{ //Alternatively use form based auth
|
} else { //Alternatively use form based auth
|
||||||
restTemplate = new RestTemplate(factory);
|
restTemplate = new RestTemplate(factory);
|
||||||
|
|
||||||
form.add("client_id", clientConfig.getClientId());
|
form.add("client_id", clientConfig.getClientId());
|
||||||
form.add("client_secret", clientConfig.getClientSecret());
|
form.add("client_secret", clientConfig.getClientSecret());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("tokenEndpointURI = " + serverConfig.getTokenEndpointUri());
|
logger.debug("tokenEndpointURI = " + serverConfig.getTokenEndpointUri());
|
||||||
logger.debug("form = " + form);
|
logger.debug("form = " + form);
|
||||||
|
|
Loading…
Reference in New Issue