Example #1
0
func main() {
	var port = flag.Int("port", 8091, "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 := login.NewRouter()
	log.Infof("Starting a server on localhost:%d", *port)
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), router))
}
Example #2
0
var _ = Describe("Login", func() {
	var router *mux.Router
	var recorder *httptest.ResponseRecorder
	var request *http.Request
	var username = "******"
	var challenge = "test"
	var provider = "testprovider"

	var token string

	BeforeEach(func() {
		util.LoadConfigByPathWOExtension("test_config")
		authn.InitMint()
		authn.InitValidator()
		router = login.NewRouter()
		recorder = httptest.NewRecorder()

		u, _ := url.Parse("/login")
		q := u.Query()
		q.Set("username", username)
		q.Set("challenge", challenge)
		q.Set("provider", provider)
		u.RawQuery = q.Encode()

		request, _ = http.NewRequest("GET", u.RequestURI(), nil)

		authn.InitMint()
		token = authn.GetToken("testuser")

	})