auth
2014-10-15
Child:a5987795707e
auth/http.go
Create a grant confirmation endpoint and its first test. Lay the framework for how we're going to write endpoints, and how we're going to test them by doing a super simple grant confirmation endpoint (where the user authorizes the grant, which can then be exchanged for a token) and a simple test to ensure that a page gets rendered when valid input is provided. We're still missing a lot of test cases: when different forms of valid input are provided (e.g., no scope, no redirect URI, etc.); when invalid input is provided; etc.
1 package auth
3 import (
4 "log"
5 "net/http"
6 )
8 const getGrantTemplateName = "get_grant"
10 func GetGrantHandler(w http.ResponseWriter, r *http.Request, context Context) {
11 w.WriteHeader(http.StatusOK)
12 err := context.Render(w, getGrantTemplateName, nil)
13 if err != nil {
14 log.Println("Error rendering template for GetGrantHandler:", err)
15 }
16 }