001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: AMAuthCallBack.java,v 1.2 2008/06/25 05:42:06 qcheng Exp $
026 *
027 */
028
029
030package com.sun.identity.authentication.spi;
031
032import java.util.Map;
033
034/**
035 * The <code>AMAuthCallBack</code> interface should be implemented by external
036 * business logic code, in order to receive callbacks from the authentication
037 * framework when one of the following events happens :
038 * <ul>
039 *  <li>account lockout</li>
040 *  <li>password change (via LDAP module)</li>
041 * </ul>
042 * <p>
043 * The event type and related information are passed through the method call
044 * {@link #authEventCallback(int, java.util.Map)}. The event parameters are
045 * stored in a hash map. See information about public static fields for more 
046 * details.
047 * <p>
048 * A plug-in class, which implements this interface, can retrieve the event
049 * parameters using the get() function of the {@link Map} interface :
050 * <code>eventParams.get(TIME_KEY);</code>
051 * <code>eventParams.get(USER_KEY);</code>
052 * <code>etc.</code>
053 * <p>
054 *
055 * @supported.all.api
056 */
057public interface AMAuthCallBack {
058
059    /**
060     * The key for the value of the callback notification time (i.e. when
061     * the event occured).
062     */
063    public static final String TIME_KEY = "timechanged";
064    
065    /**
066     * The key for the value of the module's realm, for which the
067     * callback was triggered.
068     */
069    public static final String REALM_KEY = "realm";
070    
071    /**
072     * The key for the value of the user's identity for which the
073     * callback was triggered.
074     */
075    public static final String USER_KEY = "userdn";
076    
077    /**
078     * The constant for the PASSWORD CHANGE event type.
079     */ 
080    public static final int PASSWORD_CHANGE = 1;
081
082    /**
083     * The constant for the ACCOUNT LOCKOUT event type.
084     */
085    public static final int ACCOUNT_LOCKOUT = 2;
086    
087    /**
088     * Receives the event notifications when the user status changes during
089     * the authentication process. It includes the type of event and other
090     * information pertinent to this event.
091     * @param eventType the type of event for which this method is being called
092     * @param eventParams a map of different parameters meaningful for this
093     * event.
094     * @exception AMAuthCallBackException can be thrown back
095     * if necessary (currently not supported). It will be ignored by
096     * authentication processing classes.
097     */
098    public void authEventCallback(int eventType, Map eventParams)
099        throws AMAuthCallBackException; 
100}