KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > messenger > auth > AuthProvider


1 /**
2  * $RCSfile: AuthProvider.java,v $
3  * $Revision: 1.3 $
4  * $Date: 2004/12/13 18:06:53 $
5  *
6  * Copyright (C) 2004 Jive Software. All rights reserved.
7  *
8  * This software is published under the terms of the GNU Public License (GPL),
9  * a copy of which is included in this distribution.
10  */

11
12 package org.jivesoftware.messenger.auth;
13
14 /**
15  * Provider interface for authentication. Users that wish to integrate with
16  * their own authentication system must implement this class and then register
17  * the implementation with Jive Messenger in the <tt>jive-messenger.xml</tt>
18  * file. An entry in that file would look like the following:
19  *
20  * <pre>
21  * &lt;provider&gt;
22  * &lt;auth&gt;
23  * &lt;className&gt;com.foo.auth.CustomAuthProvider&lt;/className&gt;
24  * &lt;/auth&gt;
25  * &lt;/provider&gt;</pre>
26  *
27  * @author Matt Tucker
28  */

29 public interface AuthProvider {
30
31     /**
32      * Returns true if this AuthProvider supports authentication using plain-text
33      * passwords according to JEP--0078. Plain text authentication is not secure
34      * and should generally only be used for a TLS/SSL connection.
35      *
36      * @return true if plain text password authentication is supported by
37      * this AuthProvider.
38      */

39     boolean isPlainSupported();
40
41     /**
42      * Returns true if this AuthProvider supports digest authentication
43      * according to JEP-0078.
44      *
45      * @return true if digest authentication is supported by this
46      * AuthProvider.
47      */

48     boolean isDigestSupported();
49
50     /**
51      * Returns if the username and password are valid; otherwise this
52      * method throws an UnauthorizedException.<p>
53      *
54      * If {@link #isPlainSupported()} returns false, this method should
55      * throw an UnsupportedOperationException.
56      *
57      * @param username the username.
58      * @param password the passwordl
59      * @throws UnauthorizedException if the username and password do
60      * not match any existing user.
61      */

62     void authenticate(String JavaDoc username, String JavaDoc password) throws UnauthorizedException;
63
64     /**
65      * Returns if the username, token, and digest are valid; otherwise this
66      * method throws an UnauthorizedException.<p>
67      *
68      * If {@link #isDigestSupported()} returns false, this method should
69      * throw an UnsupportedOperationException.
70      *
71      * @param username the username.
72      * @param token the token that was used with plain-text password to
73      * generate the digest.
74      * @param digest the digest generated from plain-text password and unique token.
75      * @throws UnauthorizedException if the username and password
76      * do not match any existing user.
77      */

78     void authenticate(String JavaDoc username, String JavaDoc token, String JavaDoc digest)
79             throws UnauthorizedException;
80 }
Popular Tags