1   package com.atlassian.seraph.config;
2   
3   import com.atlassian.seraph.SecurityService;
4   import com.atlassian.seraph.auth.AuthenticationContext;
5   import com.atlassian.seraph.auth.Authenticator;
6   import com.atlassian.seraph.auth.RoleMapper;
7   import com.atlassian.seraph.controller.SecurityController;
8   import com.atlassian.seraph.elevatedsecurity.ElevatedSecurityGuard;
9   import com.atlassian.seraph.interceptor.Interceptor;
10  import com.atlassian.seraph.service.rememberme.RememberMeService;
11  
12  import java.util.List;
13  
14  /**
15   * Represents the configuration of Seraph.
16   */
17  public interface SecurityConfig
18  {
19      String STORAGE_KEY = "seraph_config";
20      String BASIC_AUTH = "basic";
21  
22      List<SecurityService> getServices();
23  
24      String getLoginURL();
25  
26      String getLinkLoginURL();
27  
28      String getLogoutURL();
29  
30      String getOriginalURLKey();
31  
32      /**
33       * @return the {@link com.atlassian.seraph.auth.Authenticator} in play
34       */
35      Authenticator getAuthenticator();
36  
37      /**
38       * @return the {@link com.atlassian.seraph.auth.AuthenticationContext} in play
39       */
40      AuthenticationContext getAuthenticationContext();
41  
42      /**
43       * @return the {@link com.atlassian.seraph.controller.SecurityController} in play
44       */
45      SecurityController getController();
46  
47      /**
48       * @return the {@link com.atlassian.seraph.auth.RoleMapper} in play
49       */
50      RoleMapper getRoleMapper();
51  
52      /**
53       * @return the {@link com.atlassian.seraph.elevatedsecurity.ElevatedSecurityGuard} in play
54       */
55      ElevatedSecurityGuard getElevatedSecurityGuard();
56  
57      /**
58       * @return the {@link com.atlassian.seraph.service.rememberme.RememberMeService} in play
59       */
60      RememberMeService getRememberMeService();
61  
62      /**
63       * Returns the configured RedirectPolicy, or the default if none is configured.
64       * Will never return null.
65       * @return The configured RedirectPolicy, or the default if none is configured.
66       */
67      RedirectPolicy getRedirectPolicy();
68  
69      <T extends Interceptor> List<T> getInterceptors(Class<T> desiredInterceptorClass);
70  
71      void destroy();
72  
73      /**
74       * @return the path that should be applied to the cookie
75       */
76      String getLoginCookiePath();
77  
78      /**
79       * The name of the remember me cookie
80       */
81      String getLoginCookieKey();
82  
83      /**
84       * returns true if the remember me cookie should never be set to secure
85       */
86      boolean isInsecureCookie();
87  
88      /**
89       * @return the maximum age of the remember me cookie
90       */
91      int getAutoLoginCookieAge();
92  
93      /**
94       * @deprecated replaced by the {@link com.atlassian.seraph.service.rememberme.RememberMeService} code
95       */
96      String getCookieEncoding();
97  
98      String getAuthType();
99  
100     /**
101      * Whether the session (and the JSESSIONID) should be thrown away and replaced on successful login to prevent
102      * session fixation.
103      * @return true only if Seraph has been explicitly configured to turn on session invalidation on login.
104      */
105     boolean isInvalidateSessionOnLogin();
106 
107     /**
108      * When sessions are invalidated upon login, sometimes there are session attributes that should be excluded from
109      * the new session. List any session attribute keys here that should be excluded from the new session after
110      * login.
111      *
112      * @return a list of session attribute keys to be excluded from the newly invalidated session.
113      */
114     List<String> getInvalidateSessionExcludeList();
115 }