a4544a5a0e622ef69e38641f87ab1b5685e05911Phill Cunnington/*
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * opensso/legal/CDDLv1.0.txt
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * at opensso/legal/CDDLv1.0.txt.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: DSAMECallbackHandler.java,v 1.7 2008/08/19 19:08:54 veiming Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
ccf9d4a5c6453fa9f8b839baeee25147865fbb7dJames Phillpotts * Portions Copyrighted 2014-2016 ForgeRock AS.
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major */
ccf9d4a5c6453fa9f8b839baeee25147865fbb7dJames Phillpotts
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackage com.sun.identity.authentication.service;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
ccf9d4a5c6453fa9f8b839baeee25147865fbb7dJames Phillpottsimport static org.forgerock.openam.utils.Time.*;
ccf9d4a5c6453fa9f8b839baeee25147865fbb7dJames Phillpotts
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport java.io.IOException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport javax.security.auth.callback.Callback;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport javax.security.auth.callback.CallbackHandler;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport javax.security.auth.callback.UnsupportedCallbackException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.shared.debug.Debug;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.authentication.spi.PagePropertiesCallback;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8d3140b524c0e28c0a49dc7c7d481123ef3cfe11Chris Lee * This class is the OpenAM implementation for Java
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>CallbackHandler</code> and it can be passed to underlying
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * auth services so that it may interact with other components to retrieve
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * specific authentication data, such as usernames and passwords, or to display
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * certain information, such as error and warning messages.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster*/
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class DSAMECallbackHandler implements CallbackHandler {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // this should be read by AuthContext in order to receive
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // what callbacks the module needs
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static Debug debug = Debug.getInstance("amCallback");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster AMLoginContext am;
7d46f125408af7521e0e8021e0da5609fb8f7ec2Tom Rumsey private boolean isPureJAAS;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster LoginState loginState;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // this will be sent by AuthContext for module to read.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Callback[] submitRequiredInfo = null;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static AuthThreadManager authThreadManager ;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String sid = null;
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major private static final DSAMECallbackHandlerError HANDLER_ERROR =
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major new DSAMECallbackHandlerError("return from DSAMECallback");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Creates <code>DSAMECallbackHandler</code> object and it associates
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * login thread and login state with callback hndler
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param am <code>AMLoginContext</code> for this callback
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
7d46f125408af7521e0e8021e0da5609fb8f7ec2Tom Rumsey public DSAMECallbackHandler(AMLoginContext am, boolean isPureJAAS) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.am = am;
7d46f125408af7521e0e8021e0da5609fb8f7ec2Tom Rumsey this.isPureJAAS = isPureJAAS;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.authThreadManager= am.authThread;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.loginState = am.getLoginState();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private void setPageTimeout(Callback[] callbacks) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster long pageTimeOut = getTimeOut(callbacks);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setPageTimeOut(pageTimeOut);
ccf9d4a5c6453fa9f8b839baeee25147865fbb7dJames Phillpotts long lastCallbackSent = currentTimeMillis();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setLastCallbackSent(lastCallbackSent);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <p> Retrieves or displays the information requested in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * provided Callbacks.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <p> This method implementation checks the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * instance(s) of the <code>Callback</code> object(s) passed in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * to retrieve or display the requested information.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param callbacks an array of <code>Callback</code> objects provided
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * by an underlying security service which contains
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the information requested to be retrieved or displayed.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @exception java.io.IOException if an input or output error occurs.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @exception UnsupportedCallbackException if the implementation of this
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * method does not support one or more of the Callbacks
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * specified in the <code>callbacks</code> parameter.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void handle(Callback[] callbacks)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throws IOException, UnsupportedCallbackException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (debug.messageEnabled()) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("callback handler method");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((callbacks.length == 1) &&
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (callbacks[0] instanceof LoginStateCallback)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("LoginState Callbacks");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ((LoginStateCallback) callbacks[0]).setLoginState(loginState);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else {
7d46f125408af7521e0e8021e0da5609fb8f7ec2Tom Rumsey if (isPureJAAS) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster setPageTimeout(callbacks);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setSubmittedCallback(null,am) ;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setReceivedCallback(callbacks,am) ;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Thread thread = Thread.currentThread();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (debug.messageEnabled()) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("waiting for submitted info " + thread);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster callbacks = am.submitCallbackInfo();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // check if the thread had timedout
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (authThreadManager.isTimedOut(thread)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setTimedOut(true);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setReceivedCallback(null,am) ;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster authThreadManager.removeFromHash(thread,"timedOutHash");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw new IOException(AMAuthErrorCode.AUTH_TIMEOUT);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // check if there is a timeout
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkLoginTimeout();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (loginState.getSubmittedInfo() != null) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("DSAMEHandler: found submitted callbacks !");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // check if there is a timeout
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkLoginTimeout();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Callback[] callbacks2 = loginState.getSubmittedInfo();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster copyCallbacks(callbacks, callbacks2);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setReceivedCallback_NoThread(null);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster setPageTimeout(callbacks);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setReceivedCallback_NoThread(callbacks) ;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("Set callbacks, throwing java.lang.Error.");
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major throw HANDLER_ERROR;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (debug.messageEnabled()) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("DSAMECAllbackhandler..."+ callbacks);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
7d46f125408af7521e0e8021e0da5609fb8f7ec2Tom Rumsey if (isPureJAAS) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setReceivedCallback(null,am) ;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Clones callbacks from cb2 to cb1.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param cb1 new callbacks will be cloned from.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param cb2 original callbacks will be cloned to.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private void copyCallbacks(Callback[] cb1, Callback[] cb2) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int len1 = cb1.length;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int len2 = cb2.length;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (len1 == len2) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (int m = 0; m < len1; m++) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (cb1[m] != cb2[m]) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cb1[m] = cb2[m];
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int indx1 = 0;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int indx2 = 0;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster while (indx1 < len1 && cb1[indx1] instanceof PagePropertiesCallback) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster indx1 ++;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster while (indx2 < len2 && cb2[indx2] instanceof PagePropertiesCallback) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster indx2 ++;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster int n = len1 - indx1;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (n > len2 - indx2) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster n = len2 - indx2;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (int m = 0; m < n; m++ ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (cb1[indx1] != cb2[indx2]) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cb1[indx1] = cb2[indx2];
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster indx1 ++;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster indx2 ++;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns timeout value , 60 secs assumed if no timeout value found
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param callbacks checked for timeout.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return timeout value for callbacks.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster long getTimeOut(Callback[] callbacks) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster long pageTimeOut = 60;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (callbacks != null &&
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster callbacks[0] instanceof PagePropertiesCallback) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PagePropertiesCallback pagePropertyCallback
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster = (PagePropertiesCallback) callbacks[0];
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster pageTimeOut =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster new Integer(pagePropertyCallback.getTimeOutValue()).longValue();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return pageTimeOut;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Check login time out. LoginTimeoutException will be thrown if the login
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * time out has been reached.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @exception IOException must be thrown if the login timeout
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * has been reached.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster void checkLoginTimeout() throws IOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster long lastCallbackSent = loginState.getLastCallbackSent();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster long pageTimeOut = loginState.getPageTimeOut();
ccf9d4a5c6453fa9f8b839baeee25147865fbb7dJames Phillpotts long now = currentTimeMillis();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((lastCallbackSent + ((pageTimeOut-3)*1000)) < now) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("Page Timeout");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setTimedOut(true);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster loginState.setReceivedCallback(null,am) ;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw new IOException(AMAuthErrorCode.AUTH_TIMEOUT);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major /**
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major * This error is used to control the authentication processing: if there is a problem while processing the
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major * callbacks this error prevents the auth framework consider this error as an authentication module failure.
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major */
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major public static class DSAMECallbackHandlerError extends Error {
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major public DSAMECallbackHandlerError(String message) {
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major super(message);
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major }
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major @Override
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major public synchronized Throwable fillInStackTrace() {
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major //As this is an expected error that's used for flow control, we do not need to populate the stacktrace.
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major return this;
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major }
f99402dd6c1dc445c6da917514e1835e6584dc81Peter Major }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}