package at.gv.egovernment.moa.id.auth.data; import java.util.Date; 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 { /** * 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; private static String TARGET_PREFIX_ = Constants.URN_PREFIX_CDID + "+"; /** * 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 url) { this.oaURLRequested = url; } /** * Sets the oaPublicURLPrefix * @param url The oaPublicURLPrefix to set */ public void setPublicOAURLPrefix(String url) { this.oaPublicURLPrefix = url; } /** * Sets the bkuURL * @param url The BKU URL to set */ public void setBkuURL(String url) { this.bkuURL = url; } /** * 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; } }