a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * The contents of this file are subject to the terms
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * of the Common Development and Distribution License
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * (the License). You may not use this file except in
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * compliance with the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * You can obtain a copy of the License at
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * See the License for the specific language governing
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * permission and limitations under the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * When distributing Covered Code, include this CDDL
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Header Notice in each file and include the License file
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * If applicable, add the following below the CDDL Header,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * with the fields enclosed by brackets [] replaced by
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * your own identifying information:
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * $Id: IDPSession.java,v 1.6 2009/05/12 22:44:45 madan_ranganath Exp $
c070f56622b9a37191894cf0937d85e943ef6033Peter Major * Portions Copyrighted 2013-2015 ForgeRock AS.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.plugin.session.SessionManager;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.plugin.session.SessionProvider;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.plugin.session.SessionException;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterimport com.sun.identity.saml2.common.SAML2Utils;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * This class represents a session in the identity provider side.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * It keeps track of information that is needed for single sign on
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * as well as single log out.
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major private List<NameIDandSPpair> nameIDandSPpairs = null;
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major private String originatingLogoutRequestBinding = null;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster private String originatingLogoutRequestID = null;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster private String originatingLogoutSPEntityID = null;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Constructor for a <code>IDPSession</code>.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param session the session object corresponding
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * to the <code>IDPSession</code>
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major nameIDandSPpairs = new ArrayList<NameIDandSPpair>();
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the session object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the session object.
c070f56622b9a37191894cf0937d85e943ef6033Peter Major * Sets the session object.
c070f56622b9a37191894cf0937d85e943ef6033Peter Major * @param session The session object.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the list of <code>NameID</code> and
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * <code>SPEntityID</code> pair of the session.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the list of <code>NameID</code> and
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * <code>SPEntityID</code> pair of the session
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major public List<NameIDandSPpair> getNameIDandSPpairs() {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the pending log out request id of the session.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param id the request id
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void setPendingLogoutRequestID(String id) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the pending log out request id of the session.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return id the pending log out request id
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major * Sets the original logout request binding.
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major * @param originatingLogoutRequestBinding the original logout request binding.
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major public void setOriginatingLogoutRequestBinding(String originatingLogoutRequestBinding) {
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major this.originatingLogoutRequestBinding = originatingLogoutRequestBinding;
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major * Returns the original logout request binding.
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major * @return The original logout request binding.
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major public String getOriginatingLogoutRequestBinding() {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the original log out request id of the session.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param id the request id
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void setOriginatingLogoutRequestID(String id) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the original log out request id of the session.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the original log out request id
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public String getOriginatingLogoutRequestID() {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the original log out <code>SPEntityID</code> of the session.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param id the <code>SPEntityID</code>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void setOriginatingLogoutSPEntityID(String id) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the original log out <code>SPEntityID</code> of the session.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the original log out <code>SPEntityID</code>
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public String getOriginatingLogoutSPEntityID() {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the logoutAll property.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param enable true or false
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the logoutAll property.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the logoutAll property.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster // Handle IDP Proxy case
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns list of session partners.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return list of session partners
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Adds a session partner.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param sessionPartner session partner to be added
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void addSessionPartner(SAML2SessionPartner sessionPartner) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster while (i.hasNext()) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if (((SAML2SessionPartner)i.next()).equals(sessionPartner)){
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the first session partner of the list of session partners.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the first session partner of the list
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public SAML2SessionPartner getCurrentSessionPartner() {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Removes a session partner.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param sessionPartner session partner to be removed
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void removeSessionPartner(String sessionPartner) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster while (i.hasNext()) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster if (oldSessionPartner.isEquals(sessionPartner)) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster "SAML2Session.removeSessionPartner : Removing "
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster // end of handling IDP Proxy case
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns authentication context.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return authentication context
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #setAuthnContext(String)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets authentication context.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param authnContext authentication context to be set
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @see #getAuthnContext()
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public void setAuthnContext(String authnContext) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster public IDPSession(IDPSessionCopy idpSessionCopy) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster SessionProvider sessionProvider = SessionManager.getProvider();
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major nameIDandSPpairs = new ArrayList<NameIDandSPpair>(idpSessionCopy.getNameIDandSPpairs());
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major String tmp = idpSessionCopy.getPendingLogoutRequestID();
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major tmp = idpSessionCopy.getOriginatingLogoutRequestID();
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major tmp = idpSessionCopy.getOriginatingLogoutSPEntityID();
31e5c48be26b4540b5388450d642bbc38c0afcc0Peter Major tmp = idpSessionCopy.getOriginatingLogoutRequestBinding();
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster SAML2Utils.debug.error("Session Exception.", se);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sets the IDP Meta Alias.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param metaAlias Meta Alias
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Returns the IDP Meta Alias.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @return the IDP Meta Alias