コード例 #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
ファイル: authn_test.go プロジェクト: e-gov/fox
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

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))
			})
		})