MCPcopy Index your code
hub / github.com/coder/coder / ProvisionerKeyAuthOptional

Function ProvisionerKeyAuthOptional

coderd/httpmw/provisionerdaemon.go:112–115  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

110type provisionerKeyAuthContextKey struct{}
111
112func ProvisionerKeyAuthOptional(r *http.Request) (database.ProvisionerKey, bool) {
113 user, ok := r.Context().Value(provisionerKeyAuthContextKey{}).(database.ProvisionerKey)
114 return user, ok
115}
116
117func fallbackToPSK(ctx context.Context, psk string, next http.Handler, w http.ResponseWriter, r *http.Request, handleOptional func(code int, response codersdk.Response)) {
118 token := r.Header.Get(codersdk.ProvisionerDaemonPSK)

Callers 2

authorizeMethod · 0.92
fetchProvisionerKeyMethod · 0.92

Calls 2

ContextMethod · 0.65
ValueMethod · 0.45

Tested by

no test coverage detected