}
add(selfRegFrag);
}
private String[] authenticate(final String userId, final String password) {
final RestTemplate restTemplate = SyncopeSession.get().getRestTemplate();
// 1. Set provided credentials to check
PreemptiveAuthHttpRequestFactory requestFactory =
((PreemptiveAuthHttpRequestFactory) restTemplate.getRequestFactory());
((DefaultHttpClient) requestFactory.getHttpClient()).getCredentialsProvider().setCredentials(
requestFactory.getAuthScope(), new UsernamePasswordCredentials(userId, password));
// 2. Search authorizations for user specified by credentials
return restTemplate.getForObject(baseURL + "auth/entitlements.json", String[].class);
}