35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott/*
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * The contents of this file are subject to the terms of the Common Development and
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Distribution License (the License). You may not use this file except in compliance with the
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * License.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott *
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * specific language governing permission and limitations under the License.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott *
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * When distributing Covered Software, include this CDDL Header Notice in each file and include
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Header, with the fields enclosed by brackets [] replaced by your own identifying
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * information: "Portions copyright [year] [name of copyright owner]".
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott *
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Copyright 2015 ForgeRock AS.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott */
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshottpackage com.sun.identity.authentication.service;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshottimport com.iplanet.dpro.session.service.InternalSession;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshottimport com.iplanet.dpro.session.service.SessionService;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshottimport javax.security.auth.Subject;
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott/**
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Session activator that just destroys the old session and does not create any new session. Used for cases where
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * OpenAM is being used for authentication only and not session management.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott */
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshottenum NoSessionActivator implements SessionActivator {
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott INSTANCE;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott /**
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Destroys the existing auth session, but does not activate any new session.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott *
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * @param loginState the login state used for authentication. Unused.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * @param sessionService the session service.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * @param authSession the session used for authentication.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * @return {@code null} always
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott */
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott @Override
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott public boolean activateSession(final LoginState loginState, final SessionService sessionService,
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott final InternalSession authSession, final Subject subject,
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott final Object loginContext) {
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott sessionService.destroyInternalSession(authSession.getID());
d0da70ccbba38b773e7a7cc71bc124b06206d201Robert Wapshott return true;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott }
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott}