KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > http > Authenticator


1 // ========================================================================
2
// $Id: Authenticator.java,v 1.2 2004/05/09 20:31:40 gregwilkins Exp $
3
// Copyright 2003-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
// ========================================================================
15

16 package org.mortbay.http;
17
18 import java.io.IOException JavaDoc;
19 import java.io.Serializable JavaDoc;
20 import java.security.Principal JavaDoc;
21
22 /** Authenticator Interface.
23  * This is the interface that must be implemented to provide authentication implementations to the HttpContext.
24  */

25 public interface Authenticator extends Serializable JavaDoc
26 {
27     /** Authenticate.
28      * @param realm an <code>UserRealm</code> value
29      * @param pathInContext a <code>String</code> value
30      * @param request a <code>HttpRequest</code> value
31      * @param response a <code>HttpResponse</code> value. If non-null response is passed,
32      * then a failed authentication will result in a challenge response being
33      * set in the response.
34      * @return User <code>Principal</code> if authenticated. Null if Authentication
35      * failed. If the SecurityConstraint.__NOBODY instance is returned,
36      * the request is considered as part of the authentication process.
37      * @exception IOException if an error occurs
38      */

39     public Principal JavaDoc authenticate(
40         UserRealm realm,
41         String JavaDoc pathInContext,
42         HttpRequest request,
43         HttpResponse response)
44         throws IOException JavaDoc;
45
46     /* ------------------------------------------------------------ */
47     public String JavaDoc getAuthMethod();
48 }
49
Popular Tags