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:
These classes need some information checking the service.properties file:
- service.as.point: the end point of the AS. The available Authentication Services are:
- http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService. This is for testing purposes.
- service.sax_parser.config: the sax parser. You should use the file src/objects.config.
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:
- 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"); }

