Search in sources :

Example 1 with AccessTokenService

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

the class AccessTokenAuthenticationFilterTest method setUp.

@BeforeEach
void setUp() throws Exception {
    clock = new TestingClock();
    securityService = mock(SecurityService.class);
    accessTokenService = mock(AccessTokenService.class);
    authenticationProvider = mock(AccessTokenBasedPluginAuthenticationProvider.class);
    securityAuthConfigService = mock(SecurityAuthConfigService.class);
    response = new MockHttpServletResponse();
    filterChain = mock(FilterChain.class);
    filter = new AccessTokenAuthenticationFilter(securityService, accessTokenService, securityAuthConfigService, authenticationProvider);
    accessToken = randomAccessTokenForUser(BOB);
    when(accessTokenService.findByAccessToken(TOKEN)).thenReturn(accessToken);
    authConfig = new SecurityAuthConfig(accessToken.getAuthConfigId(), PLUGIN_ID);
    when(securityAuthConfigService.findProfile(accessToken.getAuthConfigId())).thenReturn(authConfig);
}
Also used : SecurityAuthConfigService(com.thoughtworks.go.server.service.SecurityAuthConfigService) AccessTokenBasedPluginAuthenticationProvider(com.thoughtworks.go.server.newsecurity.providers.AccessTokenBasedPluginAuthenticationProvider) SecurityAuthConfig(com.thoughtworks.go.config.SecurityAuthConfig) AccessTokenService(com.thoughtworks.go.server.service.AccessTokenService) SecurityService(com.thoughtworks.go.server.service.SecurityService) FilterChain(javax.servlet.FilterChain) TestingClock(com.thoughtworks.go.util.TestingClock) MockHttpServletResponse(com.thoughtworks.go.http.mocks.MockHttpServletResponse) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SecurityAuthConfig (com.thoughtworks.go.config.SecurityAuthConfig)1 MockHttpServletResponse (com.thoughtworks.go.http.mocks.MockHttpServletResponse)1 AccessTokenBasedPluginAuthenticationProvider (com.thoughtworks.go.server.newsecurity.providers.AccessTokenBasedPluginAuthenticationProvider)1 AccessTokenService (com.thoughtworks.go.server.service.AccessTokenService)1 SecurityAuthConfigService (com.thoughtworks.go.server.service.SecurityAuthConfigService)1 SecurityService (com.thoughtworks.go.server.service.SecurityService)1 TestingClock (com.thoughtworks.go.util.TestingClock)1 FilterChain (javax.servlet.FilterChain)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1