1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.security;
1819import org.apache.turbine.services.Service;
2021import org.apache.jetspeed.om.security.JetspeedUser;
2223/***24 * <p> The <code>PortalAuthentication</code> interface defines contract between 25 * the portal and security provider required for authentication a Jetspeed User.26 * This interface enables an application to be independent of the underlying 27 * authentication technology.28 *29 * <p> If the <code>login</code> method returns without30 * throwing an exception, then the overall authentication succeeded.31 *32 * <p> To logout the caller simply needs to invoke the <code>logout</code> method. 33 * 34 * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>35 * @version $Id: PortalAuthentication.java,v 1.3 2004/02/23 03:58:11 jford Exp $36 */3738publicinterfacePortalAuthenticationextends Service
39 {
40public String SERVICE_NAME = "PortalAuthentication";
4142/***43 * Given a public credential(username) and private credential(password), 44 * perform authentication. If authentication succeeds, a <code>JetspeedUser</code> 45 * is returned representing the authenticated subject.46 *47 * @param username a public credential of the subject to be authenticated.48 * @param password a private credentialof the subject to be authenticated.49 * @return a <code>JetspeedUser</code> object representing the authenticated subject.50 * @exception LoginException when general security provider failure.51 * @exception FailedLoginException when the authentication failed.52 * @exception AccountExpiredException when the subject's account is expired.53 * @exception CredentialExpiredException when the subject's credential is expired.54 */55JetspeedUser login(String username, String password)
56 throws LoginException;
5758/***59 * Automatically authenticates and retrieves the portal anonymous user.60 *61 * @return a <code>JetspeedUser</code> object representing the authenticated subject.62 * @exception LoginException if the authentication fails.63 */64JetspeedUser getAnonymousUser()
65 throws LoginException;
6667/***68 * Logout the <code>JetspeedUser</code>.69 *70 * The logout procedure my may include removing/destroying71 * <code>Principal</code> and <code>Credential</code> information72 * if relevant to the security provider.73 *74 * @exception LoginException if the logout fails.75 */76void logout()
77 throws LoginException;
78 }