Esempio n. 1
0
func (z ZonedUAAClient) GetClientToken(host string) (string, error) {
	uaaClient := warrant.New(warrant.Config{
		Host:          host,
		SkipVerifySSL: !z.verifySSL,
	})

	return uaaClient.Clients.GetToken(z.clientID, z.clientSecret)
}
Esempio n. 2
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Groups", func() {
	var (
		client warrant.Warrant
		group  warrant.Group
		err    error
	)

	BeforeEach(func() {
		client = warrant.New(warrant.Config{
			Host:          UAAHost,
			SkipVerifySSL: true,
			TraceWriter:   TraceWriter,
		})
	})

	AfterEach(func() {
		err = client.Groups.Delete(group.ID, UAAToken)
		Expect(err).NotTo(HaveOccurred())

		_, err = client.Groups.Get(group.ID, UAAToken)
		Expect(err).To(BeAssignableToTypeOf(warrant.NotFoundError{}))
	})

	It("creates, lists, retrieves, and deletes a group", func() {
		By("creating a new group", func() {
			group, err = client.Groups.Create("banana.read", UAAToken)
Esempio n. 3
0
package warrant_test

import (
	"github.com/pivotal-cf-experimental/warrant"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Warrant", func() {
	var client warrant.Warrant

	BeforeEach(func() {
		client = warrant.New(warrant.Config{})
	})

	It("has a users service", func() {
		Expect(client.Users).To(BeAssignableToTypeOf(warrant.UsersService{}))
	})

	It("has an clients service", func() {
		Expect(client.Clients).To(BeAssignableToTypeOf(warrant.ClientsService{}))
	})

	It("has a tokens service", func() {
		Expect(client.Tokens).To(BeAssignableToTypeOf(warrant.TokensService{}))
	})

	It("has a groups service", func() {
		Expect(client.Groups).To(BeAssignableToTypeOf(warrant.GroupsService{}))
	})