var _ = Describe("Authn", func() { var ( oldToken string newToken string err error user = "******" challenge = "test" provider = "pwd" ) s := "TEST" util.SetupSvcLogging(&s) BeforeEach(func() { util.LoadConfigByPathWOExtension("test_config") authn.InitMint() authn.InitValidator() }) Describe("Token roundtrip", func() { Context("Freshly minted token", func() { It("Fresh token should be valid", func() { user, err := authn.Validate(authn.GetToken(user)) Expect(err).To(BeNil()) Expect(user).To(Equal(user)) }) }) Context("Authenticating the user", func() { It("should return true, given valid username, challenge and provider", func() { booln := authn.Authenticate(user, challenge, provider)
) var _ = Describe("Authz", func() { var ( provider authz.Provider ) BeforeEach(func() { viper.Reset() }) Describe("Getting the provider", func() { Context("Default provider is set", func() { It("Should return nil", func() { util.LoadConfigByPathWOExtension("authz/test_config_no-provider") provider = authz.GetProvider() Expect(provider).To(BeNil()) }) }) Context("Default provider is set", func() { It("Should return simple provider", func() { util.LoadConfigByPathWOExtension("test_config") provider = authz.GetProvider() Expect(provider.GetName()).To(Equal("simple")) }) }) })