auth

Paddy 2014-10-15 Child:a5987795707e

51:116342ffc65f Go to Latest

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.

History
paddy@51 1 package auth
paddy@51 2
paddy@51 3 import (
paddy@51 4 "log"
paddy@51 5 "net/http"
paddy@51 6 )
paddy@51 7
paddy@51 8 const getGrantTemplateName = "get_grant"
paddy@51 9
paddy@51 10 func GetGrantHandler(w http.ResponseWriter, r *http.Request, context Context) {
paddy@51 11 w.WriteHeader(http.StatusOK)
paddy@51 12 err := context.Render(w, getGrantTemplateName, nil)
paddy@51 13 if err != nil {
paddy@51 14 log.Println("Error rendering template for GetGrantHandler:", err)
paddy@51 15 }
paddy@51 16 }