KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > security > PortalAuthentication


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 at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * 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 and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.services.security;
18
19 import org.apache.turbine.services.Service;
20
21 import org.apache.jetspeed.om.security.JetspeedUser;
22
23 /**
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 without
30  * 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  */

37
38 public interface PortalAuthentication extends Service
39 {
40     public String JavaDoc SERVICE_NAME = "PortalAuthentication";
41
42     /**
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      */

55     JetspeedUser login(String JavaDoc username, String JavaDoc password)
56         throws LoginException;
57
58     /**
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      */

64     JetspeedUser getAnonymousUser()
65         throws LoginException;
66
67     /**
68      * Logout the <code>JetspeedUser</code>.
69      *
70      * The logout procedure my may include removing/destroying
71      * <code>Principal</code> and <code>Credential</code> information
72      * if relevant to the security provider.
73      *
74      * @exception LoginException if the logout fails.
75      */

76     void logout()
77         throws LoginException;
78 }
79
Popular Tags