Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SIF Authentication using Java API

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.20k
    Comment on it

    You can authenticate user in your application using SIF (Service Integration Framework) Java API.

    Following is the code you can use to authenticate the user:

    Properties props = new Properties();           
    props.put("siperian-client.orsId", "MyORSId");
    props.put("siperian-client.protocol", "http");
    props.put("siperian-client.username", "MyUserName");
    props.put("siperian-client.password", "MyPassword");
    props.put("http.call.url", "http://MyApplicationName:MyAppPort/cmx/request");
     
    try {
          SiperianClient sipClient = SiperianClient.newSiperianClient(props);
          AuthenticateRequest req = new AuthenticateRequest();
          AuthenticateResponse resp = (AuthenticateResponse) sipClient.process(req);
          System.out.println("User has role(s): ");
          for (Object role : resp.getRoleNames())
                System.out.printf("\t" + (String) role + "\n");
          System.out.println("Admin? " + resp.isAdministrator());
          System.out.println("External? " + resp.isExternalAuthentication());
          System.out.println("Expires? " + resp.isPasswordExpires());
    } catch (Exception e) {
          // Login Failed
          System.out.println("Login failed.");
    }
    

    Please note that you need to change following configuration in above code, you can also user properties from configuration file if available in your application:

    MyORSId:         ORS Id which application is using.
    MyUserName       Name of user which you want to authenticate, this user need to exists on MDM Hub
    MyPassword       Password of user matching in MDM Hub.
    MyApplicationName Host on which MDM Hub is running.
    MyAppPort        Port on which MDM Hub is running.
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: