Search in sources :

Example 1 with UserAttribute

use of org.springframework.security.userdetails.memory.UserAttribute in project gocd by gocd.

the class AnonymousProcessingFilterTest method setUp.

@Before
public void setUp() {
    filter = new AnonymousProcessingFilter(goConfigService);
    filter.setKey("anonymousKey");
    UserAttribute userAttribute = createUserAttribute();
    filter.setUserAttribute(userAttribute);
}
Also used : UserAttribute(org.springframework.security.userdetails.memory.UserAttribute) Before(org.junit.Before)

Example 2 with UserAttribute

use of org.springframework.security.userdetails.memory.UserAttribute in project gocd by gocd.

the class AnonymousProcessingFilter method setUserAttributeWithRole.

private void setUserAttributeWithRole(final String role) {
    final UserAttribute initialAttribute = new UserAttribute();
    initialAttribute.setPassword("anonymousUser");
    initialAttribute.setAuthorities(new ArrayList() {

        {
            add(new GrantedAuthorityImpl(role));
        }
    });
    setUserAttribute(initialAttribute);
}
Also used : GrantedAuthorityImpl(org.springframework.security.GrantedAuthorityImpl) UserAttribute(org.springframework.security.userdetails.memory.UserAttribute) ArrayList(java.util.ArrayList)

Example 3 with UserAttribute

use of org.springframework.security.userdetails.memory.UserAttribute in project gocd by gocd.

the class AnonymousProcessingFilterTest method createUserAttribute.

private UserAttribute createUserAttribute() {
    UserAttribute userAttribute = new UserAttribute();
    userAttribute.setAuthoritiesAsString(new ArrayList<String>() {

        {
            add("ROLE_ASSHOLE");
        }
    });
    userAttribute.setPassword("anonymousPassword");
    return userAttribute;
}
Also used : UserAttribute(org.springframework.security.userdetails.memory.UserAttribute)

Aggregations

UserAttribute (org.springframework.security.userdetails.memory.UserAttribute)3 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 GrantedAuthorityImpl (org.springframework.security.GrantedAuthorityImpl)1