1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.annotation;
17
18 import java.lang.annotation.ElementType;
19 import java.lang.annotation.Retention;
20 import java.lang.annotation.RetentionPolicy;
21 import java.lang.annotation.Target;
22
23 /***
24 * Java 5 annotation for describing service layer security attributes.
25 *
26 * <p>The <code>Secured</code> annotation is used to define a list of security
27 * configuration attributes for business methods. This annotation can be used
28 * as a Java 5 alternative to XML configuration.
29 * <p>For example:
30 * <pre>
31 * @Secured ({"ROLE_USER"})
32 * public void create(Contact contact);
33 *
34 * @Secured ({"ROLE_USER", "ROLE_ADMIN"})
35 * public void update(Contact contact);
36 *
37 * @Secured ({"ROLE_ADMIN"})
38 * public void delete(Contact contact);
39 * </pre>
40 * @author Mark St.Godard
41 * @version $Id: Secured.java,v 1.2 2005/11/17 00:55:48 benalex Exp $
42 */
43 @Target({ElementType.METHOD, ElementType.TYPE})
44 @Retention(RetentionPolicy.RUNTIME)
45 public @interface Secured {
46
47
48 /***
49 * Returns the list of security configuration attributes.
50 * (i.e. ROLE_USER, ROLE_ADMIN etc.)
51 * @return String[] The secure method attributes
52 */
53 public String[] value();
54 }