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
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/http.go	Wed Oct 15 23:27:17 2014 -0400
     1.3 @@ -0,0 +1,16 @@
     1.4 +package auth
     1.5 +
     1.6 +import (
     1.7 +	"log"
     1.8 +	"net/http"
     1.9 +)
    1.10 +
    1.11 +const getGrantTemplateName = "get_grant"
    1.12 +
    1.13 +func GetGrantHandler(w http.ResponseWriter, r *http.Request, context Context) {
    1.14 +	w.WriteHeader(http.StatusOK)
    1.15 +	err := context.Render(w, getGrantTemplateName, nil)
    1.16 +	if err != nil {
    1.17 +		log.Println("Error rendering template for GetGrantHandler:", err)
    1.18 +	}
    1.19 +}