Search in sources :

Example 1 with AnonymousAuthenticationProvider

use of com.thoughtworks.go.server.newsecurity.providers.AnonymousAuthenticationProvider in project gocd by gocd.

the class AbstractReAuthenticationFilterTest method setUp.

@BeforeEach
void setUp() {
    response = new MockHttpServletResponse();
    filterChain = mock(FilterChain.class);
    securityService = mock(SecurityService.class);
    systemEnvironment = mock(SystemEnvironment.class);
    when(systemEnvironment.isReAuthenticationEnabled()).thenReturn(true);
    passwordBasedPluginAuthenticationProvider = mock(PasswordBasedPluginAuthenticationProvider.class);
    webBasedPluginAuthenticationProvider = mock(WebBasedPluginAuthenticationProvider.class);
    anonymousAuthenticationProvider = mock(AnonymousAuthenticationProvider.class);
    clock = new TestingClock();
    filter = spy(new AbstractReAuthenticationFilter(securityService, systemEnvironment, clock, passwordBasedPluginAuthenticationProvider, webBasedPluginAuthenticationProvider, anonymousAuthenticationProvider) {

        @Override
        protected void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, String errorMessage) throws IOException {
        }
    });
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) HttpServletRequest(javax.servlet.http.HttpServletRequest) PasswordBasedPluginAuthenticationProvider(com.thoughtworks.go.server.newsecurity.providers.PasswordBasedPluginAuthenticationProvider) SecurityService(com.thoughtworks.go.server.service.SecurityService) FilterChain(javax.servlet.FilterChain) WebBasedPluginAuthenticationProvider(com.thoughtworks.go.server.newsecurity.providers.WebBasedPluginAuthenticationProvider) HttpServletResponse(javax.servlet.http.HttpServletResponse) AnonymousAuthenticationProvider(com.thoughtworks.go.server.newsecurity.providers.AnonymousAuthenticationProvider) TestingClock(com.thoughtworks.go.util.TestingClock) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with AnonymousAuthenticationProvider

use of com.thoughtworks.go.server.newsecurity.providers.AnonymousAuthenticationProvider in project gocd by gocd.

the class AssumeAnonymousUserFilterTest method setUp.

@BeforeEach
void setUp() {
    clock = new TestingClock();
    securityService = mock(SecurityService.class);
    anonymousAuthenticationProvider = new AnonymousAuthenticationProvider(clock, new AuthorityGranter(securityService));
    filterChain = mock(FilterChain.class);
    response = new MockHttpServletResponse();
    request = new MockHttpServletRequest();
}
Also used : AuthorityGranter(com.thoughtworks.go.server.security.AuthorityGranter) SecurityService(com.thoughtworks.go.server.service.SecurityService) MockHttpServletRequest(com.thoughtworks.go.http.mocks.MockHttpServletRequest) FilterChain(javax.servlet.FilterChain) TestingClock(com.thoughtworks.go.util.TestingClock) AnonymousAuthenticationProvider(com.thoughtworks.go.server.newsecurity.providers.AnonymousAuthenticationProvider) MockHttpServletResponse(com.thoughtworks.go.http.mocks.MockHttpServletResponse) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with AnonymousAuthenticationProvider

use of com.thoughtworks.go.server.newsecurity.providers.AnonymousAuthenticationProvider in project gocd by gocd.

the class AuthenticationFilterChainTest method setUp.

@BeforeEach
void setUp() throws IOException {
    response = new MockHttpServletResponse();
    filterChain = mock(FilterChain.class);
    securityService = mock(SecurityService.class);
    clock = new TestingClock();
    systemEnvironment = new SystemEnvironment();
    final AnonymousAuthenticationProvider anonymousAuthenticationProvider = new AnonymousAuthenticationProvider(clock, new AuthorityGranter(securityService));
    assumeAnonymousUserFilter = new AssumeAnonymousUserFilter(securityService, anonymousAuthenticationProvider);
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) AuthorityGranter(com.thoughtworks.go.server.security.AuthorityGranter) FilterChain(javax.servlet.FilterChain) TestingClock(com.thoughtworks.go.util.TestingClock) AnonymousAuthenticationProvider(com.thoughtworks.go.server.newsecurity.providers.AnonymousAuthenticationProvider) MockHttpServletResponse(com.thoughtworks.go.http.mocks.MockHttpServletResponse) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

AnonymousAuthenticationProvider (com.thoughtworks.go.server.newsecurity.providers.AnonymousAuthenticationProvider)3 TestingClock (com.thoughtworks.go.util.TestingClock)3 FilterChain (javax.servlet.FilterChain)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 MockHttpServletResponse (com.thoughtworks.go.http.mocks.MockHttpServletResponse)2 AuthorityGranter (com.thoughtworks.go.server.security.AuthorityGranter)2 SecurityService (com.thoughtworks.go.server.service.SecurityService)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 MockHttpServletRequest (com.thoughtworks.go.http.mocks.MockHttpServletRequest)1 PasswordBasedPluginAuthenticationProvider (com.thoughtworks.go.server.newsecurity.providers.PasswordBasedPluginAuthenticationProvider)1 WebBasedPluginAuthenticationProvider (com.thoughtworks.go.server.newsecurity.providers.WebBasedPluginAuthenticationProvider)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1