@Test public void testShouldAttemptAuthenticationWhenRequestUnauthenticated() { assertTrue("should return true if not authenticated", controller.shouldAttemptAuthentication(createMockUnauthenticatedRequest())); }
private Result getUserLoginResult(HttpServletRequest request, HttpServletResponse response, OAuthMessage message, Consumer consumer, Principal user) { // if a user is provided, they must exist and be able to login if (user != null && !authenticationController.canLogin(user, request)) { LOG.info("Access denied because user:'{}' cannot login", user.getName()); sendError(response, HttpServletResponse.SC_UNAUTHORIZED, message); return new Result.Failure(new OAuthProblem.PermissionDenied(user.getName())); } LOG.info("Authenticated app '{}' as user '{}' successfully", consumer.getKey(), user == null ? "null" : user.getName()); return new Result.Success(user); }
@Test public void testShouldNotAttemptAuthenticationWhenRequestAlreadyAuthenticated() { assertFalse("should return false if already authenticated", controller.shouldAttemptAuthentication(createMockAuthenticatedRequest("hoho"))); }
if (!authenticationController.shouldAttemptAuthentication(request)) { return authenticationNotAttempted(request, response);
if (!authenticationController.shouldAttemptAuthentication(request)) { return authenticationNotAttempted(request, response);
private boolean mayProceed(HttpServletRequest request, HttpServletResponse response) if (!authenticationController.shouldAttemptAuthentication(request))
private boolean mayProceed(HttpServletRequest request, HttpServletResponse response, OAuthRequestVerifier verifier) { if (!authenticationController.shouldAttemptAuthentication(request)) { authenticationListener.authenticationNotAttempted(request, response); return true;