Example usage for org.springframework.security.cas.authentication CasAuthenticationToken CasAuthenticationToken

List of usage examples for org.springframework.security.cas.authentication CasAuthenticationToken CasAuthenticationToken

Introduction

In this page you can find the example usage for org.springframework.security.cas.authentication CasAuthenticationToken CasAuthenticationToken.

Prototype

private CasAuthenticationToken(final Integer keyHash, final Object principal, final Object credentials,
        final Collection<? extends GrantedAuthority> authorities, final UserDetails userDetails,
        final Assertion assertion) 

Source Link

Document

Private constructor for Jackson Deserialization support

Usage

From source file:com.vnomicscorp.spring.security.cas.authentication.redis.DefaultCasAuthenticationTokenSerializerTest.java

private CasAuthenticationToken makeToken() {
    return new CasAuthenticationToken(KEY, USERNAME, CREDENTIALS,
            Arrays.asList(new SimpleGrantedAuthority(ROLE)),
            new User(USERNAME, CREDENTIALS, Arrays.asList(new SimpleGrantedAuthority(ROLE))),
            new AssertionImpl(USERNAME));
}

From source file:org.fao.geonet.kernel.security.ecas.ECasAuthenticationProvider.java

private CasAuthenticationToken authenticateNow(final Authentication authentication)
        throws AuthenticationException {
    try {/*from   w  ww. j ava  2s .c om*/
        final Assertion assertion = this.ticketValidator.validate(authentication.getCredentials().toString(),
                getServiceUrl(authentication));
        final UserDetails userDetails = loadUserByAssertion(assertion);
        userDetailsChecker.check(userDetails);
        return new CasAuthenticationToken(this.key, userDetails, authentication.getCredentials(),
                authoritiesMapper.mapAuthorities(userDetails.getAuthorities()), userDetails, assertion);
    } catch (final TicketValidationException e) {
        throw new BadCredentialsException(e.getMessage(), e);
    }
}