Example #1
0
func (f Factory) NewLogin() Login {
	authenticator := api.NewUAAAuthenticator(f.repoLocator.GetConfigurationRepository())

	return NewLogin(
		f.ui,
		f.repoLocator.GetConfigurationRepository(),
		f.repoLocator.GetOrganizationRepository(),
		f.repoLocator.GetSpaceRepository(),
		authenticator,
	)
}
Example #2
0
func createAuthenticator(t *testing.T, apiServer *httptest.Server, authServer *httptest.Server) (configuration.ConfigurationRepository, api.Authenticator) {
	configRepo := testhelpers.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 := NewUAAAuthGateway()
	authenticator := api.NewUAAAuthenticator(authGateway, configRepo)

	return configRepo, authenticator
}