View Javadoc

1   package com.atlassian.asap.service.api;
2   
3   import com.atlassian.asap.service.api.TokenValidator.Policy;
4   
5   import java.lang.annotation.Documented;
6   import java.lang.annotation.ElementType;
7   import java.lang.annotation.Inherited;
8   import java.lang.annotation.Retention;
9   import java.lang.annotation.RetentionPolicy;
10  import java.lang.annotation.Target;
11  
12  /**
13   * An annotation that declares the intent for a resource to use ASAP-based authentication and authorization.
14   * <p>
15   * The annotation's parameters correspond to the corresponding methods that are documented for {@link TokenValidator};
16   * see that class for more detail about their meanings.  All values default to the same behavior that would be
17   * seen if the corresponding method is not called on the {@code TokenValidator}.
18   * </p>
19   *
20   * @since 2.8
21   */
22  @Documented
23  @Inherited
24  @Retention(RetentionPolicy.RUNTIME)
25  @Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD})
26  public @interface AsapAuth {
27      /**
28       * The issuers that are authorized to execute as per {@link TokenValidator#issuer(String...)}.
29       */
30      String[] issuer() default {};
31  
32      /**
33       * The issuers that are authorized impersonate other users, as per {@link TokenValidator#impersonationIssuer(String...)}.
34       */
35      String[] impersonationIssuer() default {};
36  
37      /**
38       * Whether or not to allow subject impersonation, as per {@link TokenValidator#subjectImpersonation(boolean)}.
39       *
40       * @deprecated as per {@link TokenValidator#subjectImpersonation(boolean)}
41       */
42      @Deprecated
43      boolean subjectImpersonation() default false;
44  
45      /**
46       * The subjects that are authorized, as per {@link TokenValidator#subject(String...)}.
47       */
48      String[] subject() default {};
49  
50      /**
51       * Explicit audience values to allow, as per {@link TokenValidator#audience(String...)}.
52       */
53      String[] audience() default {};
54  
55      /**
56       * The enforcement policy to be applied, as per {@link TokenValidator#policy(Policy)}.
57       */
58      Policy policy() default Policy.REQUIRE;
59  }