Search in sources :

Example 1 with SecurityService

use of com.thoughtworks.go.server.service.SecurityService in project gocd by gocd.

the class GoExceptionTranslationFilterTest method setUp.

@Before
public void setUp() {
    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
    filterChain = mock(FilterChain.class);
    authenticationException = mock(AuthenticationException.class);
    basicAuth = mock(BasicProcessingFilterEntryPoint.class);
    cruiseLoginFormAuth = mock(AuthenticationEntryPoint.class);
    securityService = mock(SecurityService.class);
    filter = new GoExceptionTranslationFilter();
    filter.setUrlPatternsThatShouldNotBeRedirectedToAfterLogin("(\\.json)|(/images/)");
    filter.setAuthenticationEntryPoint(cruiseLoginFormAuth);
    filter.setBasicAuthenticationEntryPoint(basicAuth);
    filter.setSecurityService(securityService);
}
Also used : AuthenticationException(org.springframework.security.AuthenticationException) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) SecurityService(com.thoughtworks.go.server.service.SecurityService) FilterChain(javax.servlet.FilterChain) AuthenticationEntryPoint(org.springframework.security.ui.AuthenticationEntryPoint) BasicProcessingFilterEntryPoint(org.springframework.security.ui.basicauth.BasicProcessingFilterEntryPoint) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Before(org.junit.Before)

Example 2 with SecurityService

use of com.thoughtworks.go.server.service.SecurityService in project gocd by gocd.

the class AuthorizationInterceptorTest method setup.

@Before
public void setup() throws Exception {
    securityService = context.mock(SecurityService.class);
    permissionInterceptor = new AuthorizationInterceptor(securityService);
    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
}
Also used : SecurityService(com.thoughtworks.go.server.service.SecurityService) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Before(org.junit.Before)

Aggregations

SecurityService (com.thoughtworks.go.server.service.SecurityService)2 Before (org.junit.Before)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2 FilterChain (javax.servlet.FilterChain)1 AuthenticationException (org.springframework.security.AuthenticationException)1 AuthenticationEntryPoint (org.springframework.security.ui.AuthenticationEntryPoint)1 BasicProcessingFilterEntryPoint (org.springframework.security.ui.basicauth.BasicProcessingFilterEntryPoint)1