AuthN in a pSR - Programatically

From GEANT2-JRA1 Wiki

There is a set of classes that you can find in perfSONAR base for requesting the authentication of a received message to the AS. You can find them in the Java package org.perfsonar.service.base.authn:

Authentication class diagram in perfSONAR base
Enlarge
Authentication class diagram in perfSONAR base

These classes need some information checking the service.properties file:

From a point of view of a pSR, services don't have multiple scenarios but they only receive requests with a Security Token, no matter which kind of token is. The following diagram shows the steps that they have to do for requesting the authentication:

Activity diagram
  • Get the security token
SecurityToken st=new SecurityToken(SecTokenManagerFactory.getDefaultSecTokenManager());
if (!st.hasSecTokenInRequest()) {
	throw new PerfSONARException("error.authn.not_sectoken","It has not sent any Security Token");
}
st.setSecTokenFromRequest();
  • Create an authentication request
AuthNRequest authnReq=new AuthNRequest(st);
  • Send the authentication request
AADispatchManager aadm=new AADispatchManager(AADispatchProtocolFactory.getDefaultAADispatchProtocol());
AuthNResponse authnRes=aadm.getAuthentication(authnReq);
  • Process the authentication response
if (authnRes.getStatus()!=AuthNResponse.AUTHENTICATED) {
	throw new PerfSONARException(authnRes.getResultCode(),"Authentication failed");
}
Personal tools