Sunday, May 15, 2016

System for Cross-domain Identity Management (SCIM)


These days enterprise applications are mushrooming inside the premise and over the cloud. All applications need to communicate with IDM system for getting basic use details or any similar info. To facilitate this communicate application owner depends on IDM system lib and expertise which makes integration painful and slower.

To overcome this issue SCIM  (System for Cross-domain Identity Management) came in picture as open standard to exchange the user information between identity domains.

SCIM standard uses JSON object to exchange info and doesn't require IDM system specified lib. Most of IDM system has implemented this feature in thr product. Oracle has also included this feature in PS3 product.


OIM SCIM Service URL in PS3 :- http://host:port/idaas/im/scim/v1/Users

To get sample JSON object using CURL in CMD
      curl --user xelsysadm:password http://host:port/idaas/im/scim/v1/Users/1

Method -
             POST [Create Resource eg - User, Group]
             GET [Get Resource]
             PUT [Update Resource]
             PATCH [Modify Particular field]
             DELETE [Delete Resource]


Java Client to get sample JSON obj ------------------

//lib - sun.misc.BASE64Decoder.jar or any BASE 64 encoder


  public static void getUser() throws Exception{
 
    String authStringEnc = "Basic "+ new String(new Decoder.BASE64Encoder().encode(("xelsysadm:password").getBytes()));
 
     URL url = new URL("http://host:port/idaas/im/scim/v1/Users?filter=userName eq SMITHJ");
     HttpURLConnection connection = null;
     connection = (HttpURLConnection) url.openConnection();
     connection.setRequestMethod("GET");
     connection.setRequestProperty("Content-Type", "application/scim+json");
     connection.setRequestProperty("Authorization", authStringEnc);
     connection.setConnectTimeout(5000);
     connection.setDoOutput(true);
     connection.setReadTimeout(5000);
         
   int responseCode = connection.getResponseCode();
   System.out.println("Response Code : " + responseCode);

    BufferedReader in = new BufferedReader(
           new InputStreamReader(connection.getInputStream()));
   String inputLine;
   StringBuffer response = new StringBuffer();

    while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
   }
   in.close();

    //print JSON Objcet
   System.out.println(response.toString());

 }

No comments:

Post a Comment