예제 #1
0
파일: auth.go 프로젝트: manuelfelipe/rsc
// newCookieSigner returns a cookie signer that uses the given builder to build login requests.
func newCookieSigner(builder loginRequestBuilder, accountID int) Authenticator {
	return &cookieSigner{
		builder:   builder,
		accountID: accountID,
		refreshAt: time.Now().Add(-2 * time.Minute),
		client:    httpclient.NewNoRedirect(),
	}
}
예제 #2
0
파일: auth.go 프로젝트: manuelfelipe/rsc
// NewSSAuthenticator returns an authenticator that wraps another one and adds the logic needed to
// create sessions in Self-Service.
func NewSSAuthenticator(auther Authenticator, accountID int) Authenticator {
	if _, ok := auther.(*ssAuthenticator); ok {
		// Only wrap if not wrapped already
		return auther
	}
	return &ssAuthenticator{
		auther:    auther,
		accountID: accountID,
		refreshAt: time.Now().Add(-2 * time.Minute),
		client:    httpclient.NewNoRedirect(),
	}
}
예제 #3
0
파일: http_test.go 프로젝트: dylanmei/rsc
					})

					AfterEach(func() {
						httpclient.DumpFormat = httpclient.NoDump
					})

					It("does dump", func() {
						Ω(stderr.String()).ShouldNot(BeEmpty())
						var js map[string]interface{}
						err := json.Unmarshal(stderr.Bytes(), &js)
						Ω(err).ShouldNot(HaveOccurred())
						Ω(js).ShouldNot(BeEmpty())
					})
				})

			})
		})
	})

	Context("created with NewNoRedirect", func() {
		BeforeEach(func() {
			client = httpclient.NewNoRedirect()
		})

		It("does not follow redirects", func() {
			Ω(resp.StatusCode).Should(Equal(303))
		})
	})

})