Java Client Authenticate
From OpenIndivo Documentation Wiki
The authenticate methods allow an actor to identify himself to the Indivo server. Currently authentication involves sending an actor's username and password (SHA-1 Hash) to the server in an AuthenticateActionType. Other options are available such as limiting the session to a single use and requiring that the session expire at a certain time. The result of a successful execution of the method is an AuthenticateResultType.
View the Java docs for method definitions and parameter descriptions.
Contents |
Code examples
Authenticate with username and password
This is the most basic (and common) method of authentication. The session returned will last indefinitely.
String username = "username@indivohealth.org";
String password = "password";
AuthenticateResultType authResult = client.authenticate(username, password);
String ticket = authResult.getActorTicket();
Authenticate with username, password, and expiration date
This method of authentication allows the caller to specify to the server that the session should expire at a certain date and time. All attempts to use the session after the expiration date and time will fail.
The following sample shows an authentication where the session will expire at 1:15AM on December 31st, 2006.
String username = "username@indivohealth.org";
String password = "password";
GregorianCalendar expirationDate = new GregorianCalendar(2006, 11, 31, 1, 15);
AuthenticateResultType authResult = client.authenticate(username, password, expiration);
String ticket = authResult.getActorTicket();
Authenticate with username, password, and single use session
This method of authentication allows the caller to specify to the server that the session should expire after a single use (one action).
String username = "username@indivohealth.org";
String password = "password";
boolean singleUse = true;
AuthenticateResultType authResult = client.authenticate(username, password, singleUse);
String ticket = authResult.getActorTicket();
Authenticate with username, password, single use session, and expiration date
This method of authentication allows the caller to specify whether the session should expire after a single use, after a certain date and time, or both.
The following example shows that the session can only be used once and that it must be used prior to 1:15AM on December 31st, 2006.
String username = "username@indivohealth.org";
String password = "password";
boolean singleUse = true;
GregorianCalendar expirationDate = new GregorianCalendar(2006, 11, 31, 1, 15);
AuthenticateResultType authResult = client.authenticate(username, password, singleUse, expiration);
String ticket = authResult.getActorTicket();

