* LoginContexts should be created by a profile handler when authentication is needed. Once control has returned to the
* profile handler, it should remove the LoginContext from the HttpSession.
*
- * The {@link AuthenticationEngine} or an {@link AuthenticationHandler} should set the
+ * The {@link AuthenticationEngine} or an {@link LoginHandler} should set the
* {@link LoginContext#setAuthenticationAttempted()}, {@link LoginContext#setPrincipalAuthenticated(boolean)},
- * {@link LoginContext#setAuthnFailure(String)}, {@link LoginContext#{setAuthenticationDuration(long)}
- * {@link LoginContext#setAuthenticationInstant(DateTime)} appropriately.
- *
+ * {@link LoginContext#setAuthenticationFailure(AuthenticationException)},
+ * {@link LoginContext#setAuthenticationDuration(long)}, {@link LoginContext#setAuthenticationInstant(DateTime)}
+ * appropriately.
*/
public class LoginContext implements Serializable {
/** Did authentication succeed? */
private boolean principalAuthenticated;
- /** Optional failure message. */
- private String authnFailureMessage;
+ /** Exception that occured during authentication. */
+ private AuthenticationException authnException;
/** The instant of authentication. */
private DateTime authnInstant;
/** The session id. */
private String sessionID;
-
+
/** List of request authentication methods. */
private ArrayList<String> requestAuthenticationMethods;
*
* @return <code>true</code> if the authentication manager must re-authenticate the user.
*/
- public boolean getForceAuth() {
+ public boolean isForceAuthRequired() {
return forceAuth;
}
*
* @return <code>true</code> if the authentication manager must not interact with the users UI.
*/
- public boolean getPassiveAuth() {
+ public boolean isPassiveAuthRequired() {
return passiveAuth;
}
*
* @param force if the authentication manager must re-authenticate the user.
*/
- public void setForceAuth(boolean force) {
+ public void setForceAuthRequired(boolean force) {
forceAuth = force;
}
*
* @param passive if the authentication manager must not interact with the users UI.
*/
- public void setPassiveAuth(boolean passive) {
+ public void setPassiveAuthRequired(boolean passive) {
passiveAuth = passive;
}
}
/**
- * Sets the optional authentication failure message.
+ * Sets the error that occurred during authentication.
*
- * @param failureMessage A description of why authN failed.
+ * @param error error that occurred during authentication
*/
- public void setAuthenticationFailureMessage(String failureMessage) {
- authnFailureMessage = failureMessage;
+ public void setAuthenticationFailure(AuthenticationException error) {
+ authnException = error;
}
/**
- * Returns the optional authentication failure message.
+ * Gets the error that occurred during authentication.
*
- * @return The failure message, or <code>null</code> is none was set.
+ * @return error that occurred during authentication
*/
- public String getAuthenticationFailureMessage() {
- return authnFailureMessage;
+ public AuthenticationException getAuthenticationFailure() {
+ return authnException;
}
/**
* Set if authentication has been attempted.
*
- * This method should be called by an {@link AuthenticationHandler} while processing a request.
+ * This method should be called by an {@link LoginHandler} while processing a request.
*/
public void setAuthenticationAttempted() {
authnAttempted = true;
}
/**
- * Gets the {@link Session} ID.
+ * Gets the {@link edu.internet2.middleware.shibboleth.idp.session.Session} ID.
*
* @return the Session id
*/
}
/**
- * Sets the {@link Session} ID.
+ * Sets the {@link edu.internet2.middleware.shibboleth.idp.session.Session} ID.
*
* @param id the Session ID
*/