Example usage for org.springframework.security.authentication AnonymousAuthenticationToken getDetails

List of usage examples for org.springframework.security.authentication AnonymousAuthenticationToken getDetails

Introduction

In this page you can find the example usage for org.springframework.security.authentication AnonymousAuthenticationToken getDetails.

Prototype

public Object getDetails() 

Source Link

Usage

From source file:at.ac.univie.isc.asio.security.HttpMethodRestrictionFilterTest.java

@Test
public void should_keep_anonymous_type() throws Exception {
    final AnonymousAuthenticationToken token = new AnonymousAuthenticationToken("key", "principal",
            Collections.<GrantedAuthority>singletonList(Permission.INVOKE_UPDATE));
    token.setDetails("details");
    setAuthentication(token);//  w w  w .ja  v  a  2 s .c  o  m
    request.setMethod(HttpMethod.GET.name());
    subject.doFilter(request, response, chain);
    final Authentication filtered = getAuthentication();
    assertThat(filtered, instanceOf(AnonymousAuthenticationToken.class));
    assertThat(filtered.getPrincipal(), equalTo(token.getPrincipal()));
    assertThat(filtered.getDetails(), equalTo(token.getDetails()));
}