public PseudoDelegationTokenAuthenticationHandler() { super(new PseudoAuthenticationHandler(PseudoAuthenticationHandler.TYPE + TYPE_POSTFIX)); }
throws IOException, AuthenticationException { AuthenticationToken token; String userName = getUserName(request); if (userName == null) { if (getAcceptAnonymous()) { token = AuthenticationToken.ANONYMOUS; } else { token = new AuthenticationToken(userName, userName, getType());
@Test public void testAnonymousOff() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false"); handler.init(props); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); AuthenticationToken token = handler.authenticate(request, response); Assert.assertNull(token); } finally { handler.destroy(); } }
@Test public void testInit() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false"); handler.init(props); Assert.assertEquals(false, handler.getAcceptAnonymous()); } finally { handler.destroy(); } }
@Test public void testType() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); Assert.assertEquals(PseudoAuthenticationHandler.TYPE, handler.getType()); }
throws IOException, AuthenticationException { AuthenticationToken token; String userName = getUserName(request); if (userName == null) { if (getAcceptAnonymous()) { token = AuthenticationToken.ANONYMOUS; } else { token = new AuthenticationToken(userName, userName, getType());
@Test public void testAnonymousOn() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true"); handler.init(props); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); AuthenticationToken token = handler.authenticate(request, response); Assert.assertEquals(AuthenticationToken.ANONYMOUS, token); } finally { handler.destroy(); } }
@Test public void testInit() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false"); handler.init(props); Assert.assertEquals(false, handler.getAcceptAnonymous()); } finally { handler.destroy(); } }
@Test public void testType() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); Assert.assertEquals(PseudoAuthenticationHandler.TYPE, handler.getType()); }
throws IOException, AuthenticationException { AuthenticationToken token; String userName = getUserName(request); if (userName == null) { if (getAcceptAnonymous()) { token = AuthenticationToken.ANONYMOUS; } else { token = new AuthenticationToken(userName, userName, getType());
@Test public void testAnonymousOn() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true"); handler.init(props); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); AuthenticationToken token = handler.authenticate(request, response); Assert.assertEquals(AuthenticationToken.ANONYMOUS, token); } finally { handler.destroy(); } }
@Test public void testInit() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false"); handler.init(props); Assert.assertEquals(false, handler.getAcceptAnonymous()); } finally { handler.destroy(); } }
@Test public void testType() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); Assert.assertEquals(PseudoAuthenticationHandler.TYPE, handler.getType()); }
public PseudoDelegationTokenAuthenticationHandler() { super(new PseudoAuthenticationHandler(PseudoAuthenticationHandler.TYPE + TYPE_POSTFIX)); }
throws IOException, AuthenticationException { AuthenticationToken token; String userName = getUserName(request); if (userName == null) { if (getAcceptAnonymous()) { token = AuthenticationToken.ANONYMOUS; } else { token = new AuthenticationToken(userName, userName, getType());
@Test public void testAnonymousOff() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false"); handler.init(props); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); AuthenticationToken token = handler.authenticate(request, response); Assert.assertNull(token); } finally { handler.destroy(); } }
public PseudoDelegationTokenAuthenticationHandler() { super(new PseudoAuthenticationHandler(PseudoAuthenticationHandler.TYPE + TYPE_POSTFIX)); }
throws IOException, AuthenticationException { AuthenticationToken token; String userName = getUserName(request); if (userName == null) { if (getAcceptAnonymous()) { token = AuthenticationToken.ANONYMOUS; } else { token = new AuthenticationToken(userName, userName, getType());
@Test public void testAnonymousOn() throws Exception { PseudoAuthenticationHandler handler = new PseudoAuthenticationHandler(); try { Properties props = new Properties(); props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true"); handler.init(props); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); AuthenticationToken token = handler.authenticate(request, response); Assert.assertEquals(AuthenticationToken.ANONYMOUS, token); } finally { handler.destroy(); } }
public PseudoDelegationTokenAuthenticationHandler() { super(new PseudoAuthenticationHandler(PseudoAuthenticationHandler.TYPE + TYPE_POSTFIX)); }