Example usage for org.springframework.security.authentication TestingAuthenticationToken getCredentials

List of usage examples for org.springframework.security.authentication TestingAuthenticationToken getCredentials

Introduction

In this page you can find the example usage for org.springframework.security.authentication TestingAuthenticationToken getCredentials.

Prototype

public Object getCredentials() 

Source Link

Usage

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

@Test
public void should_keep_other_token_properties() throws Exception {
    final TestingAuthenticationToken token = new TestingAuthenticationToken("user", "secret",
            Collections.<GrantedAuthority>singletonList(Permission.INVOKE_UPDATE));
    token.setDetails("details");
    setAuthentication(token);// w  ww.  j a v a2  s. c o m
    request.setMethod(HttpMethod.GET.name());
    subject.doFilter(request, response, chain);
    final Authentication filtered = getAuthentication();
    assertThat(filtered.getPrincipal(), equalTo(token.getPrincipal()));
    assertThat(filtered.getCredentials(), equalTo(token.getCredentials()));
    assertThat(filtered.getDetails(), equalTo(token.getDetails()));
}