/internal-github-login

Test if we can use Github as a way of controlling access to internal applications

Primary LanguageGo

Upon logging in with Github, checks whether user is part of desired organisation before setting secure cookie.

https://github.com/organizations/unee-t/settings/applications/978656

How to use

import login "github.com/unee-t/internal-github-login"

func BasicEngine() http.Handler {
	adminHandlers := alice.New(login.RequireUneeT)
	app := login.GithubOrgOnly() // sets up special routes like GH callback
	app.Handle("/", adminHandlers.ThenFunc(indexHandler))
	return app
}

func indexHandler(w http.ResponseWriter, req *http.Request) {
	fmt.Fprintf(w, "For Unee-T eyes only")
}