本文整理匯總了Golang中cf/net.NewUAAGateway函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewUAAGateway函數的具體用法?Golang NewUAAGateway怎麽用?Golang NewUAAGateway使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewUAAGateway函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setupDependencies
func setupDependencies() (deps *cliDependencies) {
if os.Getenv("CF_COLOR") == "" {
os.Setenv("CF_COLOR", "true")
}
deps = new(cliDependencies)
deps.termUI = terminal.NewUI(os.Stdin)
deps.manifestRepo = manifest.NewManifestDiskRepository()
deps.configRepo = configuration.NewRepositoryFromFilepath(configuration.DefaultFilePath(), func(err error) {
if err != nil {
deps.termUI.Failed(fmt.Sprintf("Config error: %s", err))
}
})
deps.apiRepoLocator = api.NewRepositoryLocator(deps.configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(deps.configRepo),
"cloud-controller": net.NewCloudControllerGateway(deps.configRepo),
"uaa": net.NewUAAGateway(deps.configRepo),
})
return
}
示例2: main
func main() {
fileutils.SetTmpPathPrefix("cf")
if os.Getenv("CF_COLOR") == "" {
os.Setenv("CF_COLOR", "true")
}
termUI := terminal.NewUI()
assignTemplates()
configRepo := configuration.NewConfigurationDiskRepository()
config := loadConfig(termUI, configRepo)
repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(),
"cloud-controller": net.NewCloudControllerGateway(),
"uaa": net.NewUAAGateway(),
})
cmdFactory := commands.NewFactory(termUI, config, configRepo, repoLocator)
reqFactory := requirements.NewFactory(termUI, config, repoLocator)
cmdRunner := commands.NewRunner(cmdFactory, reqFactory)
app, err := app.NewApp(cmdRunner)
if err != nil {
return
}
app.Run(os.Args)
}
示例3: main
func main() {
defer func() {
maybeSomething := recover()
if maybeSomething != nil {
displayCrashDialog()
}
}()
fileutils.SetTmpPathPrefix("cf")
if os.Getenv("CF_COLOR") == "" {
os.Setenv("CF_COLOR", "true")
}
termUI := terminal.NewUI()
configRepo := configuration.NewConfigurationDiskRepository()
config := loadConfig(termUI, configRepo)
manifestRepo := manifest.NewManifestDiskRepository()
repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(),
"cloud-controller": net.NewCloudControllerGateway(),
"uaa": net.NewUAAGateway(),
})
cmdFactory := commands.NewFactory(termUI, config, configRepo, manifestRepo, repoLocator)
reqFactory := requirements.NewFactory(termUI, config, repoLocator)
cmdRunner := commands.NewRunner(cmdFactory, reqFactory)
app, err := app.NewApp(cmdRunner)
if err != nil {
return
}
app.Run(os.Args)
}
示例4: createCommandFactory
func createCommandFactory() command_factory.Factory {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo),
"cloud-controller": net.NewCloudControllerGateway(configRepo),
"uaa": net.NewUAAGateway(configRepo),
})
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
}
示例5: createUsersRepo
func createUsersRepo(t *testing.T, ccReqs []testnet.TestRequest, uaaReqs []testnet.TestRequest) (cc *httptest.Server,
ccHandler *testnet.TestHandler, uaa *httptest.Server, uaaHandler *testnet.TestHandler, repo UserRepository) {
ccTarget := ""
uaaTarget := ""
if len(ccReqs) > 0 {
cc, ccHandler = testnet.NewTLSServer(t, ccReqs)
ccTarget = cc.URL
}
if len(uaaReqs) > 0 {
uaa, uaaHandler = testnet.NewTLSServer(t, uaaReqs)
uaaTarget = uaa.URL
}
org := cf.OrganizationFields{}
org.Guid = "some-org-guid"
config := &configuration.Configuration{
AccessToken: "BEARER my_access_token",
Target: ccTarget,
OrganizationFields: org,
}
ccGateway := net.NewCloudControllerGateway()
uaaGateway := net.NewUAAGateway()
endpointRepo := &testapi.FakeEndpointRepo{}
endpointRepo.UAAEndpointReturns.Endpoint = uaaTarget
repo = NewCloudControllerUserRepository(config, uaaGateway, ccGateway, endpointRepo)
return
}
示例6: createUsersRepo
func createUsersRepo(t *testing.T, ccReqs []testnet.TestRequest, uaaReqs []testnet.TestRequest) (cc *httptest.Server,
ccHandler *testnet.TestHandler, uaa *httptest.Server, uaaHandler *testnet.TestHandler, repo UserRepository) {
ccTarget := ""
uaaTarget := ""
if len(ccReqs) > 0 {
cc, ccHandler = testnet.NewTLSServer(t, ccReqs)
ccTarget = cc.URL
}
if len(uaaReqs) > 0 {
uaa, uaaHandler = testnet.NewTLSServer(t, uaaReqs)
uaaTarget = uaa.URL
}
config := &configuration.Configuration{
AccessToken: "BEARER my_access_token",
Target: ccTarget,
Organization: cf.Organization{Guid: "some-org-guid"},
}
ccGateway := net.NewCloudControllerGateway()
uaaGateway := net.NewUAAGateway()
endpointRepo := &testapi.FakeEndpointRepo{GetEndpointEndpoints: map[cf.EndpointType]string{
cf.UaaEndpointKey: uaaTarget,
}}
repo = NewCloudControllerUserRepository(config, uaaGateway, ccGateway, endpointRepo)
return
}
示例7: setupAuthDependencies
func setupAuthDependencies(request testnet.TestRequest) (deps authDependencies) {
deps.ts, deps.handler = testnet.NewTLSServer([]testnet.TestRequest{request})
deps.config = testconfig.NewRepository()
deps.config.SetAuthorizationEndpoint(deps.ts.URL)
deps.gateway = net.NewUAAGateway()
return
}
示例8: TestCommands
func TestCommands(t *testing.T) {
for _, cmdName := range availableCmdNames() {
ui := &testterm.FakeUI{}
config := &configuration.Configuration{}
configRepo := testconfig.FakeConfigRepository{}
repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(),
"cloud-controller": net.NewCloudControllerGateway(),
"uaa": net.NewUAAGateway(),
})
cmdFactory := commands.NewFactory(ui, config, configRepo, repoLocator)
cmdRunner := &FakeRunner{cmdFactory: cmdFactory, t: t}
app, _ := NewApp(cmdRunner)
app.Run([]string{"", cmdName})
assert.Equal(t, cmdRunner.cmdName, cmdName)
}
}
示例9: findCommand
func findCommand(cmdName string) (cmd cli.Command) {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo),
"cloud-controller": net.NewCloudControllerGateway(configRepo),
"uaa": net.NewUAAGateway(configRepo),
})
cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
requirementsFactory := &testreq.FakeReqFactory{}
cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory)
myApp := app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)
for _, cmd := range myApp.Commands {
if cmd.Name == cmdName {
return cmd
}
}
panic(fmt.Sprintf("command %s does not exist", cmdName))
return
}
示例10: setupAuthWithEndpoint
func setupAuthWithEndpoint(t *testing.T, request testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, auth UAAAuthenticationRepository) {
ts, handler = testnet.NewTLSServer(t, []testnet.TestRequest{request})
configRepo := testconfig.FakeConfigRepository{}
configRepo.Delete()
config, err := configRepo.Get()
assert.NoError(t, err)
config.AuthorizationEndpoint = ts.URL
config.AccessToken = ""
gateway := net.NewUAAGateway()
auth = NewUAAAuthenticationRepository(gateway, configRepo)
return
}
示例11: createUsersRepo
func createUsersRepo(ccReqs []testnet.TestRequest, uaaReqs []testnet.TestRequest) (cc *httptest.Server,
ccHandler *testnet.TestHandler, uaa *httptest.Server, uaaHandler *testnet.TestHandler, repo UserRepository) {
ccTarget := ""
uaaTarget := ""
if len(ccReqs) > 0 {
cc, ccHandler = testnet.NewServer(ccReqs)
ccTarget = cc.URL
}
if len(uaaReqs) > 0 {
uaa, uaaHandler = testnet.NewServer(uaaReqs)
uaaTarget = uaa.URL
}
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetApiEndpoint(ccTarget)
ccGateway := net.NewCloudControllerGateway(configRepo)
uaaGateway := net.NewUAAGateway(configRepo)
configRepo.SetUaaEndpoint(uaaTarget)
repo = NewCloudControllerUserRepository(configRepo, uaaGateway, ccGateway)
return
}
示例12: NewRepositoryLocator
func NewRepositoryLocator(config *configuration.Configuration) (loc RepositoryLocator) {
loc.config = config
loc.configurationRepo = configuration.NewConfigurationDiskRepository()
authGateway := net.NewUAAAuthGateway()
loc.authenticator = NewUAAAuthenticator(authGateway, loc.configurationRepo)
loc.cloudControllerGateway = net.NewCloudControllerGateway(loc.authenticator)
loc.uaaGateway = net.NewUAAGateway(loc.authenticator)
loc.organizationRepo = NewCloudControllerOrganizationRepository(config, loc.cloudControllerGateway)
loc.spaceRepo = NewCloudControllerSpaceRepository(config, loc.cloudControllerGateway)
loc.appRepo = NewCloudControllerApplicationRepository(config, loc.cloudControllerGateway)
loc.appSummaryRepo = NewCloudControllerAppSummaryRepository(config, loc.cloudControllerGateway, loc.appRepo)
loc.appFilesRepo = NewCloudControllerAppFilesRepository(config, loc.cloudControllerGateway)
loc.domainRepo = NewCloudControllerDomainRepository(config, loc.cloudControllerGateway)
loc.routeRepo = NewCloudControllerRouteRepository(config, loc.cloudControllerGateway)
loc.stackRepo = NewCloudControllerStackRepository(config, loc.cloudControllerGateway)
loc.serviceRepo = NewCloudControllerServiceRepository(config, loc.cloudControllerGateway)
loc.passwordRepo = NewCloudControllerPasswordRepository(config, loc.uaaGateway)
loc.logsRepo = NewLoggregatorLogsRepository(config, loc.cloudControllerGateway, LoggregatorHost)
return
}
示例13:
"org-users", "orgs", "passwd", "purge-service-offering", "push", "quotas", "rename", "rename-org",
"rename-service", "rename-service-broker", "rename-space", "restart", "routes", "scale",
"service", "service-auth-tokens", "service-brokers", "services", "set-env", "set-org-role", "set-quota",
"set-space-role", "create-shared-domain", "space", "space-users", "spaces", "stacks", "start", "stop",
"target", "unbind-service", "unmap-route", "unset-env", "unset-org-role", "unset-space-role",
"update-buildpack", "update-service-broker", "update-service-auth-token", "update-user-provided-service",
}
var _ = Describe("App", func() {
It("#NewApp", func() {
ui := &testterm.FakeUI{}
config := testconfig.NewRepository()
manifestRepo := &testmanifest.FakeManifestRepository{}
repoLocator := api.NewRepositoryLocator(config, map[string]net.Gateway{
"auth": net.NewUAAGateway(),
"cloud-controller": net.NewCloudControllerGateway(),
"uaa": net.NewUAAGateway(),
})
cmdFactory := commands.NewFactory(ui, config, manifestRepo, repoLocator)
cmdRunner := &FakeRunner{cmdFactory: cmdFactory}
for _, cmdName := range expectedCommandNames {
output := bytes.NewBuffer(make([]byte, 1024))
trace.SetStdout(output)
trace.EnableTrace()
app, err := NewApp(cmdRunner)
Expect(err).NotTo(HaveOccurred())
示例14:
"net/http"
"net/http/httptest"
testconfig "testhelpers/configuration"
testnet "testhelpers/net"
)
var _ = Describe("AuthenticationRepository", func() {
var (
gateway net.Gateway
ts *httptest.Server
handler *testnet.TestHandler
config configuration.ReadWriter
)
BeforeEach(func() {
gateway = net.NewUAAGateway()
})
AfterEach(func() {
ts.Close()
})
It("logs in", func() {
ts, handler, config = setupAuthDependencies(successfulLoginRequest)
auth := NewUAAAuthenticationRepository(gateway, config)
apiResponse := auth.Authenticate(map[string]string{
"username": "[email protected]",
"password": "bar",
})
示例15:
"net/http/httptest"
testconfig "testhelpers/configuration"
testnet "testhelpers/net"
)
var _ = Describe("AuthenticationRepository", func() {
var (
gateway net.Gateway
testServer *httptest.Server
handler *testnet.TestHandler
config configuration.ReadWriter
)
BeforeEach(func() {
config = testconfig.NewRepositoryWithDefaults()
gateway = net.NewUAAGateway(config)
})
AfterEach(func() {
testServer.Close()
})
It("logs in", func() {
testServer, handler, config = setupAuthDependencies(successfulLoginRequest)
auth := NewUAAAuthenticationRepository(gateway, config)
apiErr := auth.Authenticate(map[string]string{
"username": "[email protected]",
"password": "bar",
})