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: AMPostAuthProcessInterface.java,v 1.5 2009/01/16 23:31:34 higapa Exp $ 026 * 027 */ 028 029 030package com.sun.identity.authentication.spi; 031 032import java.util.Map; 033 034import javax.servlet.http.HttpServletRequest; 035import javax.servlet.http.HttpServletResponse; 036 037import com.iplanet.sso.SSOToken; 038 039/** 040 * The <code>AMPostAuthProcessInterface</code> interface needs to 041 * be implemented by services and applications to do post 042 * authentication processing. 043 * <p> 044 * This interface is invoked by OpenSSO Authentication 045 * service on a successful authentication , failed authentication 046 * or during logout. 047 * <p> 048 * This interface has three methods <code>onLoginSuccess</code>, 049 * <code>onLoginFailure</code> and <code>onLogout</code>. The 050 * <code>onLoginSucess</code> will be invoked when authentication 051 * is successful. The <code>onFailure</code> will be invoked on failed 052 * authentication. The <code>onLogout</code> is invoked during a logout. 053 * <p> 054 * The post processing class implementation can be configured per ORGANIZATION 055 * or SERVICE or ROLE 056 * 057 * @supported.all.api 058 */ 059public interface AMPostAuthProcessInterface { 060 061 /** 062 * Constant to represent SPI redirect URL on login success. 063 * Following sample code explains how to use this onLoginSuccess. 064 * <code> 065 * public void onLoginSuccess(Map requestParamsMap,HttpServletRequest request, 066 * HttpServletResponse response,SSOToken ssoToken)throws AuthenticationException 067 * { 068 * // Set redirect URL on login success, User will be redirected to this URL on success. 069 * if (request != null) 070 * request.setAttribute( 071 * AMPostAuthProcessInterface.POST_PROCESS_LOGIN_SUCCESS_URL, 072 * "http://www.sun.com"); 073 * } 074 *</code> 075 * Note: Setting this property will take precendence over a session proeprty 076 * <code> POST_PROCESS_SUCCESS_URL </code>, which can also be configured to 077 * redirect users after successful authentication. 078 */ 079 080 public static final String POST_PROCESS_LOGIN_SUCCESS_URL = 081 "PostProcessLoginSuccessURL"; 082 083 /** 084 * Constant to represent SPI redirect URL on login failure. 085 * Following sample code explains how to use this onLoginFailure. 086 * <code> 087 * public void onLoginFailure(Map requestParamsMap,HttpServletRequest request, 088 * HttpServletResponse response,SSOToken ssoToken)throws AuthenticationException 089 * { 090 * // Set redirect URL on login failure, User will be redirected to this URL on failure. 091 * if (request != null) 092 * request.setAttribute( 093 * AMPostAuthProcessInterface.POST_PROCESS_LOGIN_FAILURE_URL, 094 * "http://www.example.com"); 095 * } 096 *</code> 097 */ 098 public static final String POST_PROCESS_LOGIN_FAILURE_URL = 099 "PostProcessLoginFailureURL"; 100 101 /** 102 * Constant to represent SPI redirect URL on logout. 103 * Following sample code explains how to use this onLogout. 104 * <code> 105 * public void onLoginFailure(Map requestParamsMap,HttpServletRequest request, 106 * HttpServletResponse response,SSOToken ssoToken)throws AuthenticationException 107 * { 108 * // Set redirect URL on logout, User will be redirected to this URL on logout. 109 * if (request != null) 110 * request.setAttribute( 111 * AMPostAuthProcessInterface.POST_PROCESS_LOGOUT_URL, 112 * "http://opensso.dev.java.net"); 113 * } 114 *</code> 115 */ 116 public static final String POST_PROCESS_LOGOUT_URL = 117 "PostProcessLogoutURL"; 118 119 /** 120 * Post processing on successful authentication. 121 * 122 * @param requestParamsMap map containing <code>HttpServletRequest</code> 123 * parameters 124 * @param request <code>HttpServletRequest</code> object. 125 * @param response <code>HttpServletResponse</code> object. 126 * @param ssoToken authenticated user's single sign token. 127 * @exception AuthenticationException if there is an error. 128 */ 129 public void onLoginSuccess( 130 Map requestParamsMap, 131 HttpServletRequest request, 132 HttpServletResponse response, 133 SSOToken ssoToken 134 ) throws AuthenticationException; 135 136 /** 137 * Post processing on failed authentication. 138 * 139 * @param requestParamsMap map containing <code>HttpServletRequest<code> 140 * parameters. 141 * @param request <code>HttpServletRequest</code> object. 142 * @param response <code>HttpServletResponse</code> object. 143 * @throws AuthenticationException when there is an error. 144 */ 145 public void onLoginFailure( 146 Map requestParamsMap, 147 HttpServletRequest request, 148 HttpServletResponse response 149 ) throws AuthenticationException; 150 151 /** 152 * Post processing on Logout. 153 * 154 * @param request <code>HttpServletRequest</code> object. 155 * @param response <code>HttpServletResponse</code> object. 156 * @param ssoToken authenticated user's single sign on token. 157 * @throws AuthenticationException 158 */ 159 public void onLogout( 160 HttpServletRequest request, 161 HttpServletResponse response, 162 SSOToken ssoToken 163 ) throws AuthenticationException; 164}