}) }) Describe("Authorize", func() { var ( uaaServer *ghttp.Server gateway net.Gateway config core_config.ReadWriter authRepo AuthenticationRepository ) BeforeEach(func() { uaaServer = ghttp.NewServer() config = testconfig.NewRepository() config.SetAuthenticationEndpoint(uaaServer.URL()) config.SetSSHOAuthClient("ssh-oauth-client") gateway = net.NewUAAGateway(config, &testterm.FakeUI{}) authRepo = NewUAAAuthenticationRepository(gateway, config) uaaServer.AppendHandlers( ghttp.CombineHandlers( ghttp.VerifyHeader(http.Header{"authorization": []string{"auth-token"}}), ghttp.VerifyRequest("GET", "/oauth/authorize", "response_type=code&grant_type=authorization_code&client_id=ssh-oauth-client", ), ghttp.RespondWith(http.StatusFound, ``, http.Header{ "Location": []string{"https://www.cloudfoundry.example.com?code=F45jH"}, }), ), )