github.com/grailbio/base@v0.0.11/cmd/ticket-server/list.go (about) 1 package main 2 3 import ( 4 "regexp" 5 "sort" 6 7 "github.com/grailbio/base/common/log" 8 "v.io/v23/context" 9 "v.io/v23/rpc" 10 ) 11 12 type list struct{} 13 14 func newList(ctx *context.T) *list { 15 return &list{} 16 } 17 18 func (l *list) List(ctx *context.T, call rpc.ServerCall) ([]string, error) { 19 log.Info(ctx, "list request", "endpoint", "get", "blessing", call.Security().RemoteBlessings(), "ticket", call.Suffix()) 20 var result []string 21 ignored := regexp.MustCompile("blesser/*|list") 22 for t, e := range d.registry { 23 if ignore := ignored.MatchString(t); !ignore { 24 if err := e.auth.Authorize(ctx, call.Security()); err == nil { 25 result = append(result, t) 26 } 27 } 28 } 29 sort.Strings(result) 30 return result, nil 31 }