001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2009 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: FedletAdapter.java,v 1.2 2009/06/17 03:09:13 exu Exp $
026 *
027 */
028
029package com.sun.identity.saml2.plugins;
030
031import com.sun.identity.saml2.common.SAML2Exception;
032import com.sun.identity.saml2.protocol.LogoutRequest;
033import com.sun.identity.saml2.protocol.LogoutResponse;
034import javax.servlet.http.HttpServletRequest;
035import javax.servlet.http.HttpServletResponse;
036import java.util.Map;
037import java.util.List;
038
039/**
040 * The <code>FedletAdapter</code> abstract class provides methods
041 * that could be extended to perform user specific logics during SAMLv2 
042 * protocol processing on the Service Provider side. The implementation class
043 * could be configured on a per service provider basis in the extended
044 * metadata configuration.   
045 * <p>
046 * A singleton instance of this <code>FedletAdapter</code>
047 * class will be used per Service Provider during runtime, so make sure 
048 * implementation of the methods are thread safe. 
049 * @supported.all.api
050 */
051
052public abstract class FedletAdapter {
053
054    /**
055     * Constants for hosted entity id parameter
056     */
057    public static final String HOSTED_ENTITY_ID = "HOSTED_ENTITY_ID";
058
059    /**
060     * Initializes the fedlet adapter, this method will only be executed
061     * once after creation of the adapter instance.
062     * @param initParams  initial set of parameters configured in the fedlet
063     *          for this adapter. One of the parameters named
064     *          <code>HOSTED_ENTITY_ID</code> refers to the ID of this
065     *          fedlet entity.
066     */
067    public abstract void initialize(Map initParams);
068
069    /**
070     * Invokes after Fedlet receives SLO request from IDP. It does the work
071     * of logout the user.
072     * @param request servlet request
073     * @param response servlet response
074     * @param hostedEntityID entity ID for the fedlet
075     * @param idpEntityID entity id for the IDP to which the request is
076     *          received from.
077     * @param siList List of SessionIndex whose session to be logged out
078     * @param nameIDValue nameID value whose session to be logged out
079     * @param binding Single Logout binding used,
080     *      one of following values:
081     *          <code>SAML2Constants.SOAP</code>,
082     *          <code>SAML2Constants.HTTP_POST</code>,
083     *          <code>SAML2Constants.HTTP_REDIRECT</code>
084     * @return <code>true</code> if user is logged out successfully; 
085     *          <code>false</code> otherwise.
086     * @exception SAML2Exception if user want to fail the process.
087     */
088    public boolean doFedletSLO (
089        HttpServletRequest request, 
090        HttpServletResponse response, 
091        LogoutRequest logoutReq,
092        String hostedEntityID, 
093        String idpEntityID,
094        List siList,
095        String nameIDValue,
096        String binding)
097    throws SAML2Exception {
098        return true;
099    }
100
101    /**
102     * Invokes after Fedlet receives SLO response from IDP and the SLO status
103     * is success.
104     * @param request servlet request
105     * @param response servlet response
106     * @param logoutReq SAML2 <code>LogoutRequest</code> object
107     * @param logoutRes SAML2 <code>LogoutResponse</code> object
108     * @param hostedEntityID entity ID for the fedlet
109     * @param idpEntityID entity id for the IDP to which the logout response
110     *          is received from.
111     * @param binding Single Logout binding used,
112     *      one of following values:
113     *          <code>SAML2Constants.SOAP</code>,
114     *          <code>SAML2Constants.HTTP_POST</code>,
115     *          <code>SAML2Constants.HTTP_REDIRECT</code>
116     * @exception SAML2Exception if user want to fail the process.
117     */
118    public void onFedletSLOSuccess(
119        HttpServletRequest request,
120        HttpServletResponse response,
121        LogoutRequest logoutReq,
122        LogoutResponse logoutRes,
123        String hostedEntityID,
124        String idpEntityID,
125        String binding)
126    throws SAML2Exception {
127        return;
128    }
129
130    /**
131     * Invokes after Fedlet receives SLO response from IDP and the SLO status
132     * is not success.
133     * @param request servlet request
134     * @param response servlet response
135     * @param logoutReq SAML2 <code>LogoutRequest</code> object
136     * @param logoutRes SAML2 <code>LogoutResponse</code> object
137     * @param hostedEntityID entity ID for the fedlet
138     * @param idpEntityID entity id for the IDP to which the logout response
139     *          is received from.
140     * @param binding Single Logout binding used,
141     *      one of following values:
142     *          <code>SAML2Constants.SOAP</code>,
143     *          <code>SAML2Constants.HTTP_POST</code>,
144     *          <code>SAML2Constants.HTTP_REDIRECT</code>
145     * @exception SAML2Exception if user want to fail the process.
146     */
147    public void onFedletSLOFailure(
148        HttpServletRequest request,
149        HttpServletResponse response,
150        LogoutRequest logoutReq,
151        LogoutResponse logoutRes,
152        String hostedEntityID,
153        String idpEntityID,
154        String binding)
155    throws SAML2Exception {
156        return;
157    }
158} 




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.