func createAuthenticationRepository(apiServer *httptest.Server, authServer *httptest.Server) (configuration.ReadWriter, api.AuthenticationRepository) { config := testconfig.NewRepository() config.SetAuthorizationEndpoint(authServer.URL) config.SetApiEndpoint(apiServer.URL) config.SetAccessToken("bearer initial-access-token") config.SetRefreshToken("initial-refresh-token") authGateway := NewUAAGateway() authenticator := api.NewUAAAuthenticationRepository(authGateway, config) return config, authenticator }
func createAuthenticationRepository(t *testing.T, apiServer *httptest.Server, authServer *httptest.Server) (*configuration.Configuration, api.AuthenticationRepository) { configRepo := testconfig.FakeConfigRepository{} configRepo.Delete() config, err := configRepo.Get() assert.NoError(t, err) config.AuthorizationEndpoint = authServer.URL config.Target = apiServer.URL config.AccessToken = "bearer initial-access-token" config.RefreshToken = "initial-refresh-token" authGateway := NewUAAGateway() authenticator := api.NewUAAAuthenticationRepository(authGateway, configRepo) return config, authenticator }