@Override public Principal getUserPrincipal() { return super.getUserPrincipal(); }
/** * {@inheritDoc} */ @Override public Principal getUserPrincipal() { if (outerRequest != null) { return outerRequest.getUserPrincipal(); } else { return super.getUserPrincipal(); } }
public Principal getUserPrincipal() { Principal userPrincipal; Object scPrincipal = getSubjectPrincipal(); if (scPrincipal != null) { if (scPrincipal instanceof Principal) { userPrincipal = (Principal) scPrincipal; } else { userPrincipal = new ObjectPrincipal(scPrincipal); } } else { userPrincipal = super.getUserPrincipal(); } return userPrincipal; }
@Test public void testFilter() throws Exception { FilterConfig config = mockConfig("myuser"); StaticUserFilter suf = new StaticUserFilter(); suf.init(config); ArgumentCaptor<HttpServletRequestWrapper> wrapperArg = ArgumentCaptor.forClass(HttpServletRequestWrapper.class); FilterChain chain = mock(FilterChain.class); suf.doFilter(mock(HttpServletRequest.class), mock(ServletResponse.class), chain); Mockito.verify(chain).doFilter(wrapperArg.capture(), Mockito.<ServletResponse>anyObject()); HttpServletRequestWrapper wrapper = wrapperArg.getValue(); assertEquals("myuser", wrapper.getUserPrincipal().getName()); assertEquals("myuser", wrapper.getRemoteUser()); suf.destroy(); }
@Override public Principal getUserPrincipal() { Principal userPrincipal = super.getUserPrincipal(); return userPrincipal; }
public Principal getUserPrincipal() { if (_userPrincipal != null) { return _userPrincipal; } else { return super.getUserPrincipal(); } }
@Override public Principal getUserPrincipal() { if (principal == null) { return super.getUserPrincipal(); } return principal; } }
/** * {@inheritDoc} */ @Override public Principal getUserPrincipal() { // Synchronized access synchronized (mutex) { return super.getUserPrincipal(); } }
@Override public Principal getUserPrincipal() { Principal principal = super.getUserPrincipal(); if (principal != null) return principal; else return userPrincipal; }
@Override public Principal getUserPrincipal() { //this order reinforces that container-supplied userPrincipal should not be overridden in setUserPrincipal() Principal userPrincipal = super.getUserPrincipal(); if (userPrincipal == null) { userPrincipal = this.userPrincipal; } return userPrincipal; }
@Override public Principal getUserPrincipal() { //this order reinforces that container-supplied userPrincipal should not be overridden in setUserPrincipal() Principal userPrincipal = super.getUserPrincipal(); if (userPrincipal == null) { userPrincipal = this.userPrincipal; } return userPrincipal; }
@Override public Principal getUserPrincipal() { return userP != null ? userP : super.getUserPrincipal(); }
@Override public Principal getUserPrincipal() { return userP != null ? userP : super.getUserPrincipal(); }
@Override public Principal getUserPrincipal() { this.checkState(); return super.getUserPrincipal(); }
@Override public Principal getUserPrincipal() { HttpSession session = getSession(false); if (session != null) { return (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID); } return super.getUserPrincipal(); } };
@Override public Principal getUserPrincipal() { this.checkState(); return super.getUserPrincipal(); }
@Override public Principal getUserPrincipal() { HttpSession session = getSession(false); if (session != null) { return (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID); } return super.getUserPrincipal(); } };
@Override public Principal getUserPrincipal() { return getCorrectRequest().getUserPrincipal(); }
@Override public Principal getUserPrincipal() { return seamSecurityIsActive() ? identity.getPrincipal() : super.getUserPrincipal(); }
@Test public void testFilter() throws Exception { FilterConfig config = mockConfig("myuser"); StaticUserFilter suf = new StaticUserFilter(); suf.init(config); ArgumentCaptor<HttpServletRequestWrapper> wrapperArg = ArgumentCaptor.forClass(HttpServletRequestWrapper.class); FilterChain chain = mock(FilterChain.class); suf.doFilter(mock(HttpServletRequest.class), mock(ServletResponse.class), chain); Mockito.verify(chain).doFilter(wrapperArg.capture(), Mockito.<ServletResponse>anyObject()); HttpServletRequestWrapper wrapper = wrapperArg.getValue(); assertEquals("myuser", wrapper.getUserPrincipal().getName()); assertEquals("myuser", wrapper.getRemoteUser()); suf.destroy(); }