@Test public void testGetUserDetailPrincipal() throws Exception { UserDetails userDetails = new User("user", "password", Collections.<GrantedAuthority>emptyList()); Authentication authentication = new TestingAuthenticationToken(userDetails, userDetails.getPassword()); Authentication ambariAuthentication = new AmbariAuthentication(authentication, DEFAULT_USER_ID); Object principal = ambariAuthentication.getPrincipal(); assertEquals(userDetails, principal); }
@Override public Object getPrincipal() { if (principalOverride != null) { return principalOverride; } return authentication.getPrincipal(); }
AmbariAuthentication implements Authentication, UserIdAuthentication { @Override public Object getPrincipal() { if (principalOverride != null) { return principalOverride; } return authentication.getPrincipal(); } }
AmbariAuthentication implements Authentication, UserIdAuthentication { @Override public Object getPrincipal() { if (principalOverride != null) { return principalOverride; } return authentication.getPrincipal(); } AmbariAuthentication(Authentication authentication, Integer userId); }
AmbariAuthentication implements Authentication, UserIdAuthentication { @Override public Object getPrincipal() { if (principalOverride != null) { return principalOverride; } return authentication.getPrincipal(); } AmbariAuthentication(Authentication authentication, Integer userId); @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override Object getCredentials(); @Override Object getDetails(); @Override Object getPrincipal(); @Override boolean isAuthenticated(); @Override void setAuthenticated(boolean isAuthenticated); @Override String getName(); @Override boolean equals(Object o); @Override int hashCode(); @Override Integer getUserId(); }
AmbariAuthentication implements Authentication, UserIdAuthentication { @Override public Object getPrincipal() { if (principalOverride != null) { return principalOverride; } return authentication.getPrincipal(); } AmbariAuthentication(Authentication authentication, Integer userId); @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override Object getCredentials(); @Override Object getDetails(); @Override Object getPrincipal(); @Override boolean isAuthenticated(); @Override void setAuthenticated(boolean isAuthenticated); @Override String getName(); @Override boolean equals(Object o); @Override int hashCode(); @Override Integer getUserId();  }