import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;
+import edu.internet2.middleware.shibboleth.common.config.SpringConfigurationUtils;
import edu.internet2.middleware.shibboleth.idp.config.profile.ProfileHandlerNamespaceHandler;
/**
protected void doParse(Element config, BeanDefinitionBuilder builder) {
log.debug("Parsing configuration for {} authentication handler.", XMLHelper.getXSIType(config).getLocalPart());
- int duration = 30;
+ long duration = 30 * 60 * 1000;
if (config.hasAttributeNS(null, "authenticationDuration")) {
- duration = Integer.parseInt(config.getAttributeNS(null, "authenticationDuration"));
+ duration = SpringConfigurationUtils.parseDurationToMillis("'authenticationDuration' on LoginHandler of type "
+ + XMLHelper.getXSIType(config), config.getAttributeNS(null, "authenticationDuration"), 1000 * 60);
}
- log.debug("Authentication handler declared duration of {} minutes", duration);
+ log.debug("Authentication duration: {}ms", duration);
builder.addPropertyValue("authenticationDuration", duration);
String authnMethod;
private List<String> authenticationMethods;
/** Duration of the authentication, in minutes. */
- private int authenticationDuration;
+ private long authenticationDuration;
/**
- * Gets the duration of the authentication, in minutes.
+ * Gets the duration of the authentication, in milliseconds.
*
- * @return duration of the authentication, in minutes
+ * @return duration of the authentication, in milliseconds
*/
- public int getAuthenticationDuration() {
+ public long getAuthenticationDuration() {
return authenticationDuration;
}
/**
- * Sets the duration of the authentication, in minutes.
+ * Sets the duration of the authentication, in milliseconds.
*
- * @param duration duration of the authentication, in minutes
+ * @param duration duration of the authentication, in milliseconds
*/
- public void setAuthenticationDuration(int duration) {
+ public void setAuthenticationDuration(long duration) {
this.authenticationDuration = duration;
}
if (authenticationMethods != null) {
handler.getSupportedAuthenticationMethods().addAll(authenticationMethods);
}
- handler.setAuthenticationDuration(authenticationDuration * 60 * 1000);
+ handler.setAuthenticationDuration(authenticationDuration);
}
}
<xsd:attribute name="authenticationDuration" type="xsd:positiveInteger">
<xsd:annotation>
<xsd:documentation>
- The length of time, in minutes, that an authentication performed by this handler should be
+ The length of time that an authentication performed by this handler should be
considered active. After which time a user, previously authenticated by this handler, must
re-authenticate in order to assert the authentication method again.
+
+ This duration should be expressed in ISO8601 format.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>