Example #1
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/ghttp"
	"github.com/pivotal-golang/lager/lagertest"

	"github.com/concourse/atc/auth"
	"github.com/concourse/atc/auth/fakes"
)

var _ = Describe("OAuthBeginHandler", func() {
	var (
		fakeProviderA *fakes.FakeProvider
		fakeProviderB *fakes.FakeProvider

		signingKey *rsa.PrivateKey

		cookieJar *cookiejar.Jar

		server *httptest.Server
		client *http.Client
	)

	BeforeEach(func() {
		fakeProviderA = new(fakes.FakeProvider)
		fakeProviderB = new(fakes.FakeProvider)

		var err error
		signingKey, err = rsa.GenerateKey(rand.Reader, 1024)
		Expect(err).ToNot(HaveOccurred())

		handler, err := auth.NewOAuthHandler(
Example #2
0
var _ = BeforeEach(func() {
	buildsDB = new(buildfakes.FakeBuildsDB)
	configDB = new(dbfakes.FakeConfigDB)
	pipelineDBFactory = new(dbfakes.FakePipelineDBFactory)
	workerDB = new(workerserverfakes.FakeWorkerDB)
	containerDB = new(containerserverfakes.FakeContainerDB)
	volumesDB = new(volumeserverfakes.FakeVolumesDB)
	pipeDB = new(pipeserverfakes.FakePipeDB)
	pipelinesDB = new(dbfakes.FakePipelinesDB)

	authValidator = new(authfakes.FakeValidator)

	fakeTokenGenerator = new(authfakes.FakeTokenGenerator)

	authProvider1 := new(authfakes.FakeProvider)
	authProvider1.DisplayNameReturns("OAuth Provider 1")

	authProvider2 := new(authfakes.FakeProvider)
	authProvider2.DisplayNameReturns("OAuth Provider 2")

	authProviders = auth.Providers{
		"oauth-provider-1": authProvider1,
		"oauth-provider-2": authProvider2,
	}

	configValidationErr = nil
	peerAddr = "127.0.0.1:1234"
	drain = make(chan struct{})

	fakeEngine = new(enginefakes.FakeEngine)
Example #3
0
	"github.com/dgrijalva/jwt-go"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/ghttp"
	"github.com/pivotal-golang/lager/lagertest"

	"github.com/concourse/atc/auth"
	"github.com/concourse/atc/auth/fakes"
)

var _ = Describe("OAuthCallbackHandler", func() {
	var (
		fakeProviderA *fakes.FakeProvider
		fakeProviderB *fakes.FakeProvider

		signingKey *rsa.PrivateKey

		server *httptest.Server
		client *http.Client
	)

	BeforeEach(func() {
		fakeProviderA = new(fakes.FakeProvider)
		fakeProviderB = new(fakes.FakeProvider)

		var err error
		signingKey, err = rsa.GenerateKey(rand.Reader, 1024)
		Expect(err).ToNot(HaveOccurred())

		handler, err := auth.NewOAuthHandler(
			lagertest.NewTestLogger("test"),