1   package com.atlassian.seraph.auth;
2   
3   import com.atlassian.seraph.Initable;
4   
5   import javax.servlet.http.HttpServletRequest;
6   import javax.servlet.http.HttpServletResponse;
7   import java.security.Principal;
8   
9   /**
10   * An Authenticator is used to authenticate users, log them in, log them out and check their roles.
11   */
12  public interface Authenticator extends Initable
13  {
14      public final String DEFAULT_AUTHENTICATOR = "com.atlassian.seraph.auth.DefaultAuthenticator";
15  
16      public void destroy();
17  
18      public String getRemoteUser(HttpServletRequest request);
19  
20      public Principal getUser(HttpServletRequest request);
21  
22      public Principal getUser(HttpServletRequest request, HttpServletResponse response);
23  
24      /** @deprecated Use {@link RoleMapper} directly */
25      public boolean isUserInRole(HttpServletRequest request, String role);
26  
27      public boolean login(HttpServletRequest request, HttpServletResponse response, String username, String password) throws AuthenticatorException;
28  
29      public boolean login(HttpServletRequest request, HttpServletResponse response, String username, String password, boolean storeCookie) throws AuthenticatorException;
30  
31      public boolean logout(HttpServletRequest request, HttpServletResponse response) throws AuthenticatorException;
32  }