示例#1
0
文件: FoxService.go 项目: e-gov/fox
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))
}
示例#2
0
文件: authz_test.go 项目: e-gov/fox
				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"))
			})
		})

	})

	Describe("Provider authorization queries", func() {
		BeforeEach(func() {
			util.LoadConfigByPathWOExtension("test_config")
			fox.NewRouter()
			provider = authz.GetProvider()
		})

		Context("User exists and has rights", func() {
			It("Should return true", func() {
				b := provider.IsAuthorized("fantasticmrfox", "GET", "/fox/foxes/{foxId}")
				Expect(b).To(Equal(true))
			})
		})
	})
})