/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved * * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at * https://opensso.dev.java.net/public/CDDLv1.0.html or * opensso/legal/CDDLv1.0.txt * See the License for the specific language governing * permission and limitations under the License. * * When distributing Covered Code, include this CDDL * Header Notice in each file and include the License file * at opensso/legal/CDDLv1.0.txt. * If applicable, add the following below the CDDL Header, * with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * $Id: AMPostAuthProcessInterface.java,v 1.5 2009/01/16 23:31:34 higapa Exp $ * * Portions Copyrighted 2015 ForgeRock AS. */ package com.sun.identity.authentication.spi; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.iplanet.sso.SSOToken; /** * The AMPostAuthProcessInterface interface needs to * be implemented by services and applications to do post * authentication processing. *

* This interface is invoked by the OpenAM Authentication * service on a successful authentication, failed authentication * or during logout. *

* This interface has three methods onLoginSuccess, * onLoginFailure and onLogout. The * onLoginSuccess will be invoked when authentication * is successful. The onFailure will be invoked on failed * authentication. The onLogout is invoked during a logout. *

* The post processing class implementation can be configured per ORGANIZATION * or SERVICE or ROLE * * @supported.all.api */ public interface AMPostAuthProcessInterface { /** * Constant to represent SPI redirect URL on login success. * Following sample code explains how to use this onLoginSuccess. * * public void onLoginSuccess(Map requestParamsMap,HttpServletRequest request, * HttpServletResponse response,SSOToken ssoToken)throws AuthenticationException * { * // Set redirect URL on login success, User will be redirected to this URL on success. * if (request != null) * request.setAttribute( * AMPostAuthProcessInterface.POST_PROCESS_LOGIN_SUCCESS_URL, * "http://www.sun.com"); * } * * Note: Setting this property will take precendence over a session proeprty * POST_PROCESS_SUCCESS_URL , which can also be configured to * redirect users after successful authentication. */ public static final String POST_PROCESS_LOGIN_SUCCESS_URL = "PostProcessLoginSuccessURL"; /** * Constant to represent SPI redirect URL on login failure. * Following sample code explains how to use this onLoginFailure. * * public void onLoginFailure(Map requestParamsMap,HttpServletRequest request, * HttpServletResponse response,SSOToken ssoToken)throws AuthenticationException * { * // Set redirect URL on login failure, User will be redirected to this URL on failure. * if (request != null) * request.setAttribute( * AMPostAuthProcessInterface.POST_PROCESS_LOGIN_FAILURE_URL, * "http://www.example.com"); * } * */ public static final String POST_PROCESS_LOGIN_FAILURE_URL = "PostProcessLoginFailureURL"; /** * Constant to represent SPI redirect URL on logout. * Following sample code explains how to use this onLogout. * * public void onLoginFailure(Map requestParamsMap,HttpServletRequest request, * HttpServletResponse response,SSOToken ssoToken)throws AuthenticationException * { * // Set redirect URL on logout, User will be redirected to this URL on logout. * if (request != null) * request.setAttribute( * AMPostAuthProcessInterface.POST_PROCESS_LOGOUT_URL, * "http://opensso.dev.java.net"); * } * */ public static final String POST_PROCESS_LOGOUT_URL = "PostProcessLogoutURL"; /** * Post processing on successful authentication. * * @param requestParamsMap map containing HttpServletRequest * parameters * @param request HttpServletRequest object. * @param response HttpServletResponse object. * @param ssoToken authenticated user's single sign token. * @exception AuthenticationException if there is an error. */ public void onLoginSuccess( Map requestParamsMap, HttpServletRequest request, HttpServletResponse response, SSOToken ssoToken ) throws AuthenticationException; /** * Post processing on failed authentication. * * @param requestParamsMap map containing HttpServletRequest * parameters. * @param request HttpServletRequest object. * @param response HttpServletResponse object. * @throws AuthenticationException when there is an error. */ public void onLoginFailure( Map requestParamsMap, HttpServletRequest request, HttpServletResponse response ) throws AuthenticationException; /** * Post processing on Logout. * * @param request HttpServletRequest object. * @param response HttpServletResponse object. * @param ssoToken authenticated user's single sign on token. * @throws AuthenticationException */ public void onLogout( HttpServletRequest request, HttpServletResponse response, SSOToken ssoToken ) throws AuthenticationException; }