Esempio n. 1
0
func main() {

	var port = flag.Int("port", 8090, "Port to bind to on the localhost interface")
	var env = flag.String("env", "DEV", "Environment the binary runs in. Accepts DEV and PROD")
	flag.Parse()

	util.SetupSvcLogging(env)
	util.InitConfig()
	authn.InitValidator()

	router := fox.NewRouter()
	log.Infof("Starting a server on localhost:%d", *port)
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), router))
}
Esempio n. 2
0
	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)
				Expect(booln).To(BeTrue())
			})