/******************************************************************************* *******************************************************************************/ package at.gv.egiz.eidas.specific.connector.builder; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.w3c.dom.DOMException; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.idp.IAuthData; import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; import at.gv.egiz.eaaf.core.api.idp.auth.data.IAuthProcessDataContainer; import at.gv.egiz.eaaf.core.exceptions.EAAFAuthenticationException; import at.gv.egiz.eaaf.core.exceptions.EAAFBuilderException; import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException; import at.gv.egiz.eaaf.core.exceptions.EAAFParserException; import at.gv.egiz.eaaf.core.exceptions.XPathException; import at.gv.egiz.eaaf.core.impl.data.Pair; import at.gv.egiz.eaaf.core.impl.idp.AuthenticationData; import at.gv.egiz.eaaf.core.impl.idp.auth.builder.AbstractAuthenticationDataBuilder; import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper; import at.gv.egiz.eidas.specific.connector.MSeIDASNodeConstants; @Service("AuthenticationDataBuilder") public class AuthenticationDataBuilder extends AbstractAuthenticationDataBuilder { private static final Logger log = LoggerFactory.getLogger(AuthenticationDataBuilder.class); @Override public IAuthData buildAuthenticationData(IRequest pendingReq) throws EAAFAuthenticationException { IAuthProcessDataContainer authProcessData = pendingReq.getSessionData(AuthProcessDataWrapper.class); AuthenticationData authData = new AuthenticationData(); try { generateBasicAuthData(authData, pendingReq, authProcessData); //set specific informations authData.setSsoSessionValidTo(new Date(new Date().getTime() + MSeIDASNodeConstants.DEFAULT_PVP_ASSERTION_VALIDITY * 60 * 1000)); } catch (EAAFBuilderException | EAAFParserException | EAAFConfigurationException | XPathException | DOMException e) { log.warn("Can not build authentication data from auth. process information"); throw new EAAFAuthenticationException("builder.11", new Object[]{e.getMessage()}, e); } return authData; } @Override protected Pair buildOAspecificbPK(IRequest pendingReq, AuthenticationData authData) throws EAAFBuilderException { //TODO: check if bPK already exists return super.buildOAspecificbPK(pendingReq, authData); } @Override protected Pair getEncryptedbPKFromPVPAttribute(IAuthProcessDataContainer arg0, AuthenticationData arg1, ISPConfiguration arg2) throws EAAFBuilderException { return null; } @Override protected Pair getbaseIDFromSZR(AuthenticationData arg0, String arg1, String arg2) { return null; } }