// 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(), } }
// 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(), } }
}) 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)) }) }) })