1 package com.atlassian.security.auth.trustedapps.filter;
2
3 import javax.servlet.http.HttpServletRequest;
4 import java.security.Principal;
5
6 /**
7 * Allows the underlying framework to communicate Trusted Apps authentication mechanim details
8 */
9 public interface AuthenticationController
10 {
11 /**
12 * Check whether or not authentication via Trusted Apps should be tried. Tyipcally this will return
13 * <code>true</code> if the current principal is not already authenticated.
14 *
15 * @param request the current {@link HttpServletRequest}
16 * @return <code>true</code> if Trusted Apps authentication should be tried, <code>false</code> otherwise.
17 */
18 boolean shouldAttemptAuthentication(HttpServletRequest request);
19
20
21 /**
22 * Check whether the given principal can log into the application for the current request.
23 *
24 * @param principal the identified principal
25 * @param request the current {@link HttpServletRequest}
26 * @return <code>true</code> if the principal is allowed to login for the given request, <code>false</code>
27 * otherwise.
28 */
29 boolean canLogin(Principal principal, HttpServletRequest request);
30 }