MCPcopy Create free account
hub / github.com/cloudflare/cfssl / NewHandlerFromSigner

Function NewHandlerFromSigner

api/signhandler/signhandler.go:32–57  ·  view source on GitHub ↗

NewHandlerFromSigner generates a new Handler directly from an existing signer.

(signer signer.Signer)

Source from the content-addressed store, hash-verified

30// NewHandlerFromSigner generates a new Handler directly from
31// an existing signer.
32func NewHandlerFromSigner(signer signer.Signer) (h *api.HTTPHandler, err error) {
33 policy := signer.Policy()
34 if policy == nil {
35 err = errors.New(errors.PolicyError, errors.InvalidPolicy)
36 return
37 }
38
39 // Sign will only respond for profiles that have no auth provider.
40 // So if all of the profiles require authentication, we return an error.
41 haveUnauth := (policy.Default.Provider == nil)
42 for _, profile := range policy.Profiles {
43 haveUnauth = haveUnauth || (profile.Provider == nil)
44 }
45
46 if !haveUnauth {
47 err = errors.New(errors.PolicyError, errors.InvalidPolicy)
48 return
49 }
50
51 return &api.HTTPHandler{
52 Handler: &Handler{
53 signer: signer,
54 },
55 Methods: []string{"POST"},
56 }, nil
57}
58
59// SetBundler allows injecting an optional Bundler into the Handler.
60func (h *Handler) SetBundler(caBundleFile, intBundleFile string) (err error) {

Callers 3

serve.goFile · 0.92
NewHandlerFunction · 0.92
TestSignerDBPersistenceFunction · 0.85

Calls 2

NewFunction · 0.92
PolicyMethod · 0.65

Tested by 1

TestSignerDBPersistenceFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…