Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func Auth(c *revel.Controller) bool {
if LoggedInCheck() {//write your own
return true
}
email, pass, _ := c.Request.BasicAuth()
//login n password
//TODO check login here
//...
if email == "" {
//bypass revel to http.Response (c.Response.Out)
c.Response.Out.Header().Add("WWW-Authenticate", `Basic realm="MY REALM"`)
c.Response.Out.WriteHeader(401)
c.Response.Out.Write([]byte("401 Unauthorized\n"))
return false
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.