@Override public SecurityToken getToken() { return new AuthInfo(request).getSecurityToken(); }
/** * Get the hosted domain for this request. * * @return The domain, or {@code null} if no domain was found */ public String getAuthType() { return getRequestAttribute(req, Attribute.AUTH_TYPE); }
/** * Set the auth type for the request. * * @param authType The named auth type * @return This object */ AuthInfo setAuthType(String authType) { setRequestAttribute(req, Attribute.AUTH_TYPE, authType); return this; }
@Test public void testBinding() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); SecurityToken token = new FakeGadgetToken(); new AuthInfo(req).setSecurityToken(token).setAuthType("FakeAuth"); Injector injector = Guice.createInjector(new TestModule(req)); AuthInfo injected = injector.getInstance(AuthInfo.class); assertEquals(token, injected.getSecurityToken()); assertEquals("FakeAuth", injected.getAuthType()); }
@Test public void testToken() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); SecurityToken token = new FakeGadgetToken(); AuthInfo info = new AuthInfo(req).setSecurityToken(token); assertEquals(token, info.getSecurityToken()); // This should work when creating a new AuthInfo from the same request assertEquals(token, new AuthInfo(req).getSecurityToken()); }
SecurityToken token = handler.getSecurityTokenFromRequest(req); if (token != null) { new AuthInfo(req).setAuthType(handler.getName()).setSecurityToken(token); callChain(chain, req, resp); return;
@Test public void testAuthType() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); AuthInfo info = new AuthInfo(req).setAuthType("FakeAuth"); assertEquals("FakeAuth", info.getAuthType()); // This should work when creating a new AuthInfo from the same request assertEquals("FakeAuth", new AuthInfo(req).getAuthType()); }
@Test public void testBinding() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); SecurityToken token = new FakeGadgetToken(); new AuthInfo(req).setSecurityToken(token).setAuthType("FakeAuth"); Injector injector = Guice.createInjector(new TestModule(req)); AuthInfo injected = injector.getInstance(AuthInfo.class); assertEquals(token, injected.getSecurityToken()); assertEquals("FakeAuth", injected.getAuthType()); }
@Test public void testToken() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); SecurityToken token = new FakeGadgetToken(); AuthInfo info = new AuthInfo(req).setSecurityToken(token); assertEquals(token, info.getSecurityToken()); // This should work when creating a new AuthInfo from the same request assertEquals(token, new AuthInfo(req).getSecurityToken()); }
SecurityToken token = handler.getSecurityTokenFromRequest(req); if (token != null) { new AuthInfo(req).setAuthType(handler.getName()).setSecurityToken(token); callChain(chain, req, resp); return;
@Test public void testAuthType() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); AuthInfo info = new AuthInfo(req).setAuthType("FakeAuth"); assertEquals("FakeAuth", info.getAuthType()); // This should work when creating a new AuthInfo from the same request assertEquals("FakeAuth", new AuthInfo(req).getAuthType()); }
protected SecurityToken getSecurityToken(HttpServletRequest servletRequest) { return new AuthInfo(servletRequest).getSecurityToken(); }
/** * Get the security token for this request. * * @return The security token */ public SecurityToken getSecurityToken() { return getRequestAttribute(req, Attribute.SECURITY_TOKEN); }
/** * Set the security token for the request. * * @param token The security token * @return This object */ AuthInfo setSecurityToken(SecurityToken token) { setRequestAttribute(req, Attribute.SECURITY_TOKEN, token); return this; }
@Override public SecurityToken getToken() { return new AuthInfo(request).getSecurityToken(); }
/** * Get the hosted domain for this request. * * @return The domain, or {@code null} if no domain was found */ public String getAuthType() { return getRequestAttribute(req, Attribute.AUTH_TYPE); }
/** * Set the auth type for the request. * * @param authType The named auth type * @return This object */ AuthInfo setAuthType(String authType) { setRequestAttribute(req, Attribute.AUTH_TYPE, authType); return this; }
protected SecurityToken getSecurityToken(HttpServletRequest servletRequest) { return new AuthInfo(servletRequest).getSecurityToken(); }
/** * Get the security token for this request. * * @return The security token */ public SecurityToken getSecurityToken() { return getRequestAttribute(req, Attribute.SECURITY_TOKEN); }
/** * Set the security token for the request. * * @param token The security token * @return This object */ AuthInfo setSecurityToken(SecurityToken token) { setRequestAttribute(req, Attribute.SECURITY_TOKEN, token); return this; }