In this example the Moria2-enabled service initiates an authentication session, requesting the user attributes tgt and eduPersonAffiliation. Note that the service does not force the user to to go through interactive authentication, that is, does not deny the use of SSO; this would result in Moria2 not returning the tgt (ticket granting ticket) attribute, which is exclusively used for SSO. Once the user has been authenticated by Moria2, the user should be redirected back to the service URL
http://www.service.org/STARTIDsessionSTOPID
The SOAP implementation used in this example is Axis.
import javax.xml.namespace.QName; import org.apache.axis.client.Call; ... Call call = new Call("http://localhost:8080/moria/v2_1/Authentication?WSDL")); call.setUsername("service_username"); call.setPassword("service_password"); final Object[] parameters = { ["tgt", "eduPersonAffiliation"], "http://www.service.org/?STARTID=", "STOPID", new Boolean(false) }; final String loginURL = (String) call.invoke(new QName("initiateAuthentication"), parameters);
The above code assumes that Moria2 is deployed locally. The service
should now redirect the user to the URL given by loginURL
.