List of usage examples for org.springframework.security.authentication RememberMeAuthenticationToken setDetails
public void setDetails(Object details)
From source file:com.pedra.storefront.security.AcceleratorRememberMeServices.java
@Override protected Authentication createSuccessfulAuthentication(final HttpServletRequest request, final UserDetails user) { getUserService().setCurrentUser(getUserService().getUserForUID(user.getUsername())); if (getSessionService().getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES) != null) { getCustomerFacade().rememberMeLoginSuccessWithUrlEncoding( Boolean.TRUE.equals(getSessionService().getAttribute(WebConstants.LANGUAGE_ENCODING)), Boolean.TRUE.equals(getSessionService().getAttribute(WebConstants.CURRENCY_ENCODING))); } else {//from www.j a v a 2 s . c om getCustomerFacade().loginSuccess(); } final RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(getKey(), user, user.getAuthorities()); auth.setDetails(getAuthenticationDetailsSource().buildDetails(request)); return auth; }
From source file:com.exxonmobile.ace.hybris.storefront.security.AcceleratorRememberMeServices.java
@Override protected Authentication createSuccessfulAuthentication(final HttpServletRequest request, final UserDetails user) { getUserService().setCurrentUser(getUserService().getUserForUID(user.getUsername())); if (StringUtils.isNotEmpty(getUrlEncoderService().getUrlEncodingPattern())) { getCustomerFacade().rememberMeLoginSuccessWithUrlEncoding( getUrlEncoderService().isLanguageEncodingEnabled(), getUrlEncoderService().isCurrencyEncodingEnabled()); } else {/*from w ww . j ava 2 s .c o m*/ getCustomerFacade().loginSuccess(); } final RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(getKey(), user, user.getAuthorities()); auth.setDetails(getAuthenticationDetailsSource().buildDetails(request)); return auth; }
From source file:com.acc.storefront.security.AcceleratorRememberMeServices.java
@Override protected Authentication createSuccessfulAuthentication(final HttpServletRequest request, final UserDetails user) { getUserService().setCurrentUser(getUserService().getUserForUID(user.getUsername())); if (StringUtils.isNotEmpty(getUrlEncoderService().getUrlEncodingPattern())) { getCustomerFacade().rememberMeLoginSuccessWithUrlEncoding( getUrlEncoderService().isLanguageEncodingEnabled(), getUrlEncoderService().isCurrencyEncodingEnabled()); } else {//from w w w. j a va 2 s. com getCustomerFacade().loginSuccess(); } final RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(getKey(), user, user.getAuthorities()); auth.setDetails(getAuthenticationDetailsSource().buildDetails(request)); return auth; }
From source file:at.ac.univie.isc.asio.security.HttpMethodRestrictionFilterTest.java
@Test public void should_keep_rememberme_type() throws Exception { final RememberMeAuthenticationToken token = new RememberMeAuthenticationToken("key", "principal", Collections.<GrantedAuthority>singletonList(Permission.INVOKE_UPDATE)); token.setDetails("details"); setAuthentication(token);//from ww w .j av a2 s . c o m request.setMethod(HttpMethod.GET.name()); subject.doFilter(request, response, chain); final Authentication filtered = getAuthentication(); assertThat(filtered, instanceOf(RememberMeAuthenticationToken.class)); assertThat(filtered.getPrincipal(), equalTo(token.getPrincipal())); assertThat(filtered.getDetails(), equalTo(token.getDetails())); }
From source file:org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.java
/** * Creates the final <tt>Authentication</tt> object returned from the * <tt>autoLogin</tt> method. * <p>/*from ww w . j av a 2s . c om*/ * By default it will create a <tt>RememberMeAuthenticationToken</tt> instance. * * @param request the original request. The configured * <tt>AuthenticationDetailsSource</tt> will use this to build the details property of * the returned object. * @param user the <tt>UserDetails</tt> loaded from the <tt>UserDetailsService</tt>. * This will be stored as the principal. * * @return the <tt>Authentication</tt> for the remember-me authenticated user */ protected Authentication createSuccessfulAuthentication(HttpServletRequest request, UserDetails user) { RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(key, user, authoritiesMapper.mapAuthorities(user.getAuthorities())); auth.setDetails(authenticationDetailsSource.buildDetails(request)); return auth; }