Search in sources :

Example 1 with DigestAuthenticationEntryPoint

use of org.springframework.security.web.authentication.www.DigestAuthenticationEntryPoint in project spring-security by spring-projects.

the class SecurityMockMvcRequestPostProcessorsDigestTests method setup.

@Before
public void setup() {
    this.password = "password";
    request = new MockHttpServletRequest();
    entryPoint = new DigestAuthenticationEntryPoint();
    entryPoint.setKey("key");
    entryPoint.setRealmName("Spring Security");
    filter = new DigestAuthenticationFilter();
    filter.setUserDetailsService(new UserDetailsService() {

        public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
            return new User(username, password, AuthorityUtils.createAuthorityList("ROLE_USER"));
        }
    });
    filter.setAuthenticationEntryPoint(entryPoint);
    filter.afterPropertiesSet();
}
Also used : DigestAuthenticationEntryPoint(org.springframework.security.web.authentication.www.DigestAuthenticationEntryPoint) UsernameNotFoundException(org.springframework.security.core.userdetails.UsernameNotFoundException) UserDetails(org.springframework.security.core.userdetails.UserDetails) User(org.springframework.security.core.userdetails.User) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) DigestAuthenticationFilter(org.springframework.security.web.authentication.www.DigestAuthenticationFilter) UserDetailsService(org.springframework.security.core.userdetails.UserDetailsService) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 User (org.springframework.security.core.userdetails.User)1 UserDetails (org.springframework.security.core.userdetails.UserDetails)1 UserDetailsService (org.springframework.security.core.userdetails.UserDetailsService)1 UsernameNotFoundException (org.springframework.security.core.userdetails.UsernameNotFoundException)1 DigestAuthenticationEntryPoint (org.springframework.security.web.authentication.www.DigestAuthenticationEntryPoint)1 DigestAuthenticationFilter (org.springframework.security.web.authentication.www.DigestAuthenticationFilter)1