package at.gv.egovernment.moa.id.auth.data; import java.util.Date; import java.util.List; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Constants; /** * Session data to be stored between AuthenticationServer API calls. * * @author Paul Ivancsics * @version $Id$ */ public class AuthenticationSession { private static String TARGET_PREFIX_ = Constants.URN_PREFIX_CDID + "+"; /** * session ID */ private String sessionID; /** * "Geschäftsbereich" the online application belongs to; maybe null * if the online application is a business application */ private String target; /** * public online application URL requested */ private String oaURLRequested; /** * public online application URL prefix */ private String oaPublicURLPrefix; /** * URL of MOA ID authentication component */ private String authURL; /** * HTML template URL */ private String templateURL; /** * URL of the BKU */ private String bkuURL; /** * identity link read from smartcard */ private IdentityLink identityLink; /** * authentication block to be signed by the user */ private String authBlock; /** * timestamp logging when authentication session has been created */ private Date timestampStart; /** * timestamp logging when identity link has been received */ private Date timestampIdentityLink; /** * Indicates whether the corresponding online application is a business * service or not */ private boolean businessService; /** * SAML attributes from an extended infobox validation to be appended * to the SAML assertion delivered to the final online application. */ private List extendedSAMLAttributesOA; /** * The boolean value for either a target or a wbPK is provided as * SAML Attribute in the SAML Assertion or not. */ private boolean samlAttributeGebeORwbpk; /** * SAML attributes from an extended infobox validation to be appended * to the SAML assertion of the AUTHBlock. */ private List extendedSAMLAttributesAUTH; /** * The issuing time of the AUTH-Block SAML assertion. */ private String issueInstant; /** * Constructor for AuthenticationSession. * * @param id Session ID */ public AuthenticationSession(String id) { sessionID = id; setTimestampStart(); } /** * Returns the identityLink. * @return IdentityLink */ public IdentityLink getIdentityLink() { return identityLink; } /** * Returns the sessionID. * @return String */ public String getSessionID() { return sessionID; } /** * Sets the identityLink. * @param identityLink The identityLink to set */ public void setIdentityLink(IdentityLink identityLink) { this.identityLink = identityLink; } /** * Sets the sessionID. * @param sessionId The sessionID to set */ public void setSessionID(String sessionId) { this.sessionID = sessionId; } /** * Returns the oaURLRequested. * @return String */ public String getOAURLRequested() { return oaURLRequested; } /** * Returns the oaURLRequested. * @return String */ public String getPublicOAURLPrefix() { return oaPublicURLPrefix; } /** * Returns the BKU URL. * @return String */ public String getBkuURL() { return bkuURL; } /** * Returns the target. * @return String */ public String getTarget() { return target; } /** * Sets the oaURLRequested. * @param oaURLRequested The oaURLRequested to set */ public void setOAURLRequested(String oaURLRequested) { this.oaURLRequested = oaURLRequested; } /** * Sets the oaPublicURLPrefix * @param oaPublicURLPrefix The oaPublicURLPrefix to set */ public void setPublicOAURLPrefix(String oaPublicURLPrefix) { this.oaPublicURLPrefix = oaPublicURLPrefix; } /** * Sets the bkuURL * @param bkuURL The BKU URL to set */ public void setBkuURL(String bkuURL) { this.bkuURL = bkuURL; } /** * Sets the target. If the target includes the target prefix, the prefix will be stripped off. * @param target The target to set */ public void setTarget(String target) { if (target != null && target.startsWith(TARGET_PREFIX_)) { // If target starts with prefix "urn:publicid:gv.at:cdid+"; remove prefix this.target = target.substring(TARGET_PREFIX_.length()); Logger.debug("Target prefix stripped off; resulting target: " + this.target); } else { this.target = target; } } /** * Returns the authURL. * @return String */ public String getAuthURL() { return authURL; } /** * Sets the authURL. * @param authURL The authURL to set */ public void setAuthURL(String authURL) { this.authURL = authURL; } /** * Returns the authBlock. * @return String */ public String getAuthBlock() { return authBlock; } /** * Sets the authBlock. * @param authBlock The authBlock to set */ public void setAuthBlock(String authBlock) { this.authBlock = authBlock; } /** * Returns the timestampIdentityLink. * @return Date */ public Date getTimestampIdentityLink() { return timestampIdentityLink; } /** * Returns the businessService. * @return true if the corresponding online application is * a business application, otherwise false */ public boolean getBusinessService() { return businessService; } /** * Sets the businessService variable. * @param businessService the value for setting the businessService variable. */ public void setBusinessService(boolean businessService) { this.businessService = businessService; } /** * Returns the timestampStart. * @return Date */ public Date getTimestampStart() { return timestampStart; } /** * Sets the current date as timestampIdentityLink. */ public void setTimestampIdentityLink() { timestampIdentityLink = new Date(); } /** * Sets the current date as timestampStart. */ public void setTimestampStart() { timestampStart = new Date(); } /** * @return template URL */ public String getTemplateURL() { return templateURL; } /** * @param string the template URL */ public void setTemplateURL(String string) { templateURL = string; } /** * Returns the SAML Attributes to be appended to the AUTHBlock. Maybe null. * * @return The SAML Attributes to be appended to the AUTHBlock. Maybe null. */ public List getExtendedSAMLAttributesAUTH() { return extendedSAMLAttributesAUTH; } /** * Sets the SAML Attributes to be appended to the AUTHBlock. * * @param extendedSAMLAttributesAUTH The SAML Attributes to be appended to the AUTHBlock. */ public void setExtendedSAMLAttributesAUTH( List extendedSAMLAttributesAUTH) { this.extendedSAMLAttributesAUTH = extendedSAMLAttributesAUTH; } /** * Returns the SAML Attributes to be appended to the SAML assertion * delivered to the online application. Maybe null. * * @return The SAML Attributes to be appended to the SAML assertion * delivered to the online application */ public List getExtendedSAMLAttributesOA() { return extendedSAMLAttributesOA; } /** * Sets the SAML Attributes to be appended to the SAML assertion * delivered to the online application. * * @param extendedSAMLAttributesOA The SAML Attributes to be appended to the SAML * assertion delivered to the online application. */ public void setExtendedSAMLAttributesOA( List extendedSAMLAttributesOA) { this.extendedSAMLAttributesOA = extendedSAMLAttributesOA; } /** * Returns the boolean value for either a target or a wbPK is * provided as SAML Attribute in the SAML Assertion or not. * * @return true either a target or a wbPK is provided as SAML Attribute * in the SAML Assertion or false if not. */ public boolean getSAMLAttributeGebeORwbpk() { return this.samlAttributeGebeORwbpk; } /** * Sets the boolean value for either a target or a wbPK is * provided as SAML Attribute in the SAML Assertion or not. * * @param samlAttributeGebeORwbpk The boolean for value either a target or * wbPK is provided as SAML Attribute in the SAML Assertion or not. */ public void setSAMLAttributeGebeORwbpk(boolean samlAttributeGebeORwbpk) { this.samlAttributeGebeORwbpk = samlAttributeGebeORwbpk; } /** * Returns the issuing time of the AUTH-Block SAML assertion. * * @return The issuing time of the AUTH-Block SAML assertion. */ public String getIssueInstant() { return issueInstant; } /** * Sets the issuing time of the AUTH-Block SAML assertion. * * @param issueInstant The issueInstant to set. */ public void setIssueInstant(String issueInstant) { this.issueInstant = issueInstant; } }