InvitationsAuthenticationTrustResolver implements AuthenticationTrustResolver { @Override public boolean isAnonymous(Authentication authentication) { if (authentication != null && authentication.getAuthorities() != null && authentication.getAuthorities().contains(UaaAuthority.UAA_INVITED)) { return false; } else { return delegate.isAnonymous(authentication); } }  @Override boolean isAnonymous(Authentication authentication); @Override boolean isRememberMe(Authentication authentication);  }
@Test public void testIsAnonymous() { InvitationsAuthenticationTrustResolver resolver = new InvitationsAuthenticationTrustResolver(); AnonymousAuthenticationToken invitedAuthenticationToken = new AnonymousAuthenticationToken("key", new Object(), Collections.singletonList(UaaAuthority.UAA_INVITED)); assertFalse(resolver.isAnonymous(invitedAuthenticationToken)); AnonymousAuthenticationToken anonymousAuthenticationToken = new AnonymousAuthenticationToken("key", new Object(), Collections.singletonList(UaaAuthority.UAA_USER)); assertTrue(resolver.isAnonymous(anonymousAuthenticationToken)); }