View Javadoc
1   package com.atlassian.refapp.auth.internal;
2   
3   import com.atlassian.seraph.auth.Authenticator;
4   import com.atlassian.seraph.auth.AuthenticatorException;
5   import com.atlassian.seraph.config.SecurityConfig;
6   
7   import javax.servlet.http.HttpServletRequest;
8   import javax.servlet.http.HttpServletResponse;
9   import java.security.Principal;
10  import java.util.Map;
11  
12  public class StaticDelegatingAuthenticator implements Authenticator {
13      private static Authenticator authenticator;
14  
15      static void setAuthenticator(Authenticator authenticator) {
16          StaticDelegatingAuthenticator.authenticator = authenticator;
17      }
18  
19      public void init(Map params, SecurityConfig securityConfig) {
20          authenticator.init(params, securityConfig);
21      }
22  
23      public String getRemoteUser(HttpServletRequest request) {
24          return authenticator.getRemoteUser(request);
25      }
26  
27      public Principal getUser(HttpServletRequest request, HttpServletResponse response) {
28          return authenticator.getUser(request, response);
29      }
30  
31      public Principal getUser(HttpServletRequest request) {
32          return authenticator.getUser(request);
33      }
34  
35      public boolean isUserInRole(HttpServletRequest request, String role) {
36          return authenticator.isUserInRole(request, role);
37      }
38  
39      public boolean login(HttpServletRequest request, HttpServletResponse response, String username, String password, boolean cookie)
40              throws AuthenticatorException {
41          return authenticator.login(request, response, username, password, cookie);
42      }
43  
44      public boolean login(HttpServletRequest request, HttpServletResponse response, String username, String password) throws AuthenticatorException {
45          return authenticator.login(request, response, username, password);
46      }
47  
48      public boolean logout(HttpServletRequest request, HttpServletResponse response)
49              throws AuthenticatorException {
50          return authenticator.logout(request, response);
51      }
52  
53      public void destroy() {
54          authenticator.destroy();
55      }
56  
57  }