Thank you Thomas, as per the documentation the SCIM API's are protected by default. I tried to use the SCIM-client library and its giving below error.
2018-10-15 22:22:54,683 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
Exception--null
java.lang.NullPointerException at gluu.scim2.client.TestModeScimClient.triggerRegistrationIfNeeded(TestModeScimClient.java:103)
at gluu.scim2.client.TestModeScimClient.<init>(TestModeScimClient.java:74)
at gluu.scim2.client.factory.ScimClientFactory.getTestClient(ScimClientFactory.java:87)
at gluu.scim2.client.factory.ScimClientFactory.getTestClient(ScimClientFactory.java:105)
at TestScimClient.simpleSearch(TestScimClient.java:22)
**Here is the java code using SCIM-Client Library** which is giving the above error
public class TestScimClient {
private String domainURL="https://mygluser.com/identity/restv1";
private String OIDCMetadataUrl="https:/mygluserv.com/.well-known/openid-configuration";
private Logger logger = LogManager.getLogger(getClass());
private void simpleSearch() throws Exception {
ClientSideService client=ScimClientFactory.getTestClient(domainURL, OIDCMetadataUrl);
//ClientSideService client=ScimClientFactory.getClient(domainURL, OIDCMetadataUrl);
String filter = "userName eq \"admin\"";
System.out.println("ClientSideService Object: "+client);
Response response = client.searchUsers(filter, 1, 1, null, null, null, null);
logger.debug(response.readEntity(String.class));
System.out.println("Response: "+response);
List<BaseScimResource> resources=response.readEntity(ListResponse.class).getResources();
logger.info("Length of results list is: {}", resources.size());
UserResource admin=(UserResource) resources.get(0);
logger.info("First user in the list is: {}" + admin.getDisplayName());
client.close();
}
public static void main(String[] args){
TestScimClient testScimClient = new TestScimClient();
try{
testScimClient.simpleSearch();
}catch(Exception e){
System.out.println("Exception--"+e.getMessage());
e.printStackTrace();
}
}
}
I would request you to please guide me in how to proceed for both
1. Generating the token manually
2. Using SCIM-Client library