AuthorizationPolicy.java 2.14 KB
Newer Older
Gaston Dombiak's avatar
Gaston Dombiak committed
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision: $
 * $Date: 2006-04-07 09:28:54 -0500 (Fri, 07 Apr 2006) $
 *
6
 * Copyright (C) 2004-2008 Jive Software. All rights reserved.
Gaston Dombiak's avatar
Gaston Dombiak committed
7
 *
8 9 10 11 12 13 14 15 16 17 18
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
Gaston Dombiak's avatar
Gaston Dombiak committed
19 20
 */

21
package org.jivesoftware.openfire.auth;
Gaston Dombiak's avatar
Gaston Dombiak committed
22 23

/**
24 25
 * This is the interface the AuthorizationManager uses to
 * conduct authorizations.
26
 * <p>
27 28
 * Users that wish to integrate with their own authorization
 * system must implement this interface, and are strongly
Gaston Dombiak's avatar
Gaston Dombiak committed
29 30 31
 * encouraged to extend either the AbstractAuthoriationPolicy
 * or the AbstractAuthorizationProvider classes which allow
 * the admin console manage the classes more effectively.
32
 * Register the class with Openfire in the <tt>openfire.xml</tt>
Gaston Dombiak's avatar
Gaston Dombiak committed
33
 * file.  An entry in that file would look like the following:
34
 * </p>
Gaston Dombiak's avatar
Gaston Dombiak committed
35 36
 * <pre>
 *   &lt;provider&gt;
37
 *     &lt;authorization&gt;
Gaston Dombiak's avatar
Gaston Dombiak committed
38
 *       &lt;classlist&gt;com.foo.auth.CustomPolicyProvider&lt;/classlist&gt;
39
 *     &lt;/authorization&gt;
Gaston Dombiak's avatar
Gaston Dombiak committed
40 41 42 43
 *   &lt;/provider&gt;</pre>
 *
 * @author Jay Kline
 */
44
public interface AuthorizationPolicy {
Gaston Dombiak's avatar
Gaston Dombiak committed
45 46

    /**
guus's avatar
guus committed
47
     * Returns true if the principal is explicitly authorized to the JID
Gaston Dombiak's avatar
Gaston Dombiak committed
48
     *
49
     * @param username  The username requested.
Gaston Dombiak's avatar
Gaston Dombiak committed
50 51 52 53 54
     * @param principal The principal requesting the username.
     * @return true is the user is authorized to be principal
     */
    public boolean authorize(String username, String principal);

55 56 57 58 59 60 61 62 63 64 65 66 67
    /**
     * Returns the short name of the Policy
     *
     * @return The short name of the Policy
     */
    public abstract String name();

    /**
     * Returns a description of the Policy
     *
     * @return The description of the Policy.
     */
    public abstract String description();
Gaston Dombiak's avatar
Gaston Dombiak committed
68
}