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

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

Introduction

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

Prototype

public AnonymousAuthenticationFilter(String key, Object principal, List<GrantedAuthority> authorities) 

Source Link

Usage

From source file:org.opendatakit.configuration.SecurityConfiguration.java

@Bean
public AnonymousAuthenticationFilter anonymousFilter()
        throws ODKEntityNotFoundException, ODKOverQuotaException, ODKDatastoreException, PropertyVetoException {
    String siteKey = ServerPreferencesPropertiesTable.getSiteKey(userServiceConfiguration.callingContext());
    List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
    authorities.add(new SimpleGrantedAuthority("USER_IS_ANONYMOUS"));

    return new AnonymousAuthenticationFilter(siteKey, "anonymousUser", authorities);

}

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();/*  w  w w. ja  va 2  s  .  c o m*/
    return new HttpServletRequestFilterWrapper(filter);
}