auth

Paddy 2014-10-22 Parent:116342ffc65f Child:a5987795707e

55:cfab12566289 Go to Latest

auth/http.go

Update Context with new CheckEndpoint and CountEndpoints. Update the Context.CheckEndpoint method to pass through the new "strict" parameter that controls how URLs are checked for validation. Add a Context.CountEndpoints method to safely access the number of endpoints in stored for the client in the associent ClientStore. Finally, remove the error return from Context.Render, as we'd only ever want to log that, anyways. So we may as well just log it from the central function.

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 }