01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * 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.acegisecurity;
17:
18: import java.io.Serializable;
19:
20: /**
21: * Represents an authority granted to an {@link Authentication} object.
22: *
23: * <p>
24: * A <code>GrantedAuthority</code> must either represent itself as a
25: * <code>String</code> or be specifically supported by an {@link
26: * AccessDecisionManager}.
27: * </p>
28: *
29: * @author Ben Alex
30: * @version $Id: GrantedAuthority.java 1784 2007-02-24 21:00:24Z luke_t $
31: */
32: public interface GrantedAuthority extends Serializable {
33: //~ Methods ========================================================================================================
34:
35: /**
36: * If the <code>GrantedAuthority</code> can be represented as a <code>String</code> and that
37: * <code>String</code> is sufficient in precision to be relied upon for an access control decision by an {@link
38: * AccessDecisionManager} (or delegate), this method should return such a <code>String</code>.<p>If the
39: * <code>GrantedAuthority</code> cannot be expressed with sufficient precision as a <code>String</code>,
40: * <code>null</code> should be returned. Returning <code>null</code> will require an
41: * <code>AccessDecisionManager</code> (or delegate) to specifically support the <code>GrantedAuthority</code>
42: * implementation, so returning <code>null</code> should be avoided unless actually required.</p>
43: *
44: * @return a representation of the granted authority (or <code>null</code> if the granted authority cannot be
45: * expressed as a <code>String</code> with sufficient precision).
46: */
47: String getAuthority();
48: }
|