AmbariAuthentication implements Authentication, UserIdAuthentication { @Override public Object getCredentials() { return authentication.getCredentials(); } 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();  }
@Test public void testGetCredentials() throws Exception { String passord = "password"; Authentication authentication = new TestingAuthenticationToken("user", passord); Authentication ambariAuthentication = new AmbariAuthentication(authentication, DEFAULT_USER_ID); Object credentials = ambariAuthentication.getCredentials(); assertSame(passord, credentials); }