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.annotation;
17:
18: import java.lang.annotation.Documented;
19: import java.lang.annotation.ElementType;
20: import java.lang.annotation.Inherited;
21: import java.lang.annotation.Retention;
22: import java.lang.annotation.RetentionPolicy;
23: import java.lang.annotation.Target;
24:
25: /**
26: * Java 5 annotation for describing service layer security attributes.
27: *
28: * <p>The <code>Secured</code> annotation is used to define a list of security
29: * configuration attributes for business methods. This annotation can be used
30: * as a Java 5 alternative to XML configuration.
31: * <p>For example:
32: * <pre>
33: * @Secured ({"ROLE_USER"})
34: * public void create(Contact contact);
35: *
36: * @Secured ({"ROLE_USER", "ROLE_ADMIN"})
37: * public void update(Contact contact);
38: *
39: * @Secured ({"ROLE_ADMIN"})
40: * public void delete(Contact contact);
41: * </pre>
42: * @author Mark St.Godard
43: * @version $Id: Secured.java 1496 2006-05-23 13:38:33Z benalex $
44: */
45: @Target({ElementType.METHOD,ElementType.TYPE})
46: @Retention(RetentionPolicy.RUNTIME)
47: @Inherited
48: @Documented
49: public @interface Secured {
50: /**
51: * Returns the list of security configuration attributes.
52: * (i.e. ROLE_USER, ROLE_ADMIN etc.)
53: * @return String[] The secure method attributes
54: */
55: public String[] value();
56: }
|