Example usage for org.springframework.security.web.authentication AnonymousAuthenticationFilter afterPropertiesSet

List of usage examples for org.springframework.security.web.authentication AnonymousAuthenticationFilter afterPropertiesSet

Introduction

In this page you can find the example usage for org.springframework.security.web.authentication AnonymousAuthenticationFilter afterPropertiesSet.

Prototype

@Override
    public void afterPropertiesSet() 

Source Link

Usage

From source file:nu.localhost.tapestry5.springsecurity.services.SecurityModule.java

@Marker(SpringSecurityServices.class)
public static HttpServletRequestFilter buildAnonymousProcessingFilter(
        @Inject @Value("${spring-security.anonymous.attribute}") final String anonymousAttr,
        @Inject @Value("${spring-security.anonymous.key}") final String anonymousKey) throws Exception {

    final UserAttributeEditor attrEditor = new UserAttributeEditor();
    attrEditor.setAsText(anonymousAttr);
    final UserAttribute attr = (UserAttribute) attrEditor.getValue();

    final AnonymousAuthenticationFilter filter = new AnonymousAuthenticationFilter(anonymousKey,
            "anonymousUser", attr.getAuthorities());
    filter.afterPropertiesSet();
    return new HttpServletRequestFilterWrapper(filter);
}

From source file:ch.astina.hesperid.web.services.SecurityModule.java

/**
 * Detects if there is no <code>Authentication</code> object in the
 * <code>SecurityContextHolder</code>, and populates it with one if needed.
 *//*from  w  w w  . j a v a  2s.  co m*/
@Marker(SpringSecurityServices.class)
public static HttpServletRequestFilter buildAnonymousProcessingFilter(
        @Inject @Value("${spring-security.anonymous.attribute}") final String anonymousAttr,
        @Inject @Value("${spring-security.anonymous.key}") final String anonymousKey) throws Exception {
    AnonymousAuthenticationFilter filter = new AnonymousAuthenticationFilter();
    filter.setKey(anonymousKey);
    UserAttributeEditor attrEditor = new UserAttributeEditor();
    attrEditor.setAsText(anonymousAttr);
    UserAttribute attr = (UserAttribute) attrEditor.getValue();
    filter.setUserAttribute(attr);
    filter.afterPropertiesSet();
    return new HttpServletRequestFilterWrapper(filter);
}