mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
#23525 # Demo <div> <a href="https://www.loom.com/share/e252ac2038b34941a9043867f79228f3"> <p>[Demo] Handling timeout and insufficient permission errors in NDES #23525 - Watch Video</p> </a> <a href="https://www.loom.com/share/e252ac2038b34941a9043867f79228f3"> <img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/e252ac2038b34941a9043867f79228f3-2ff60eb9e0f54dd5-full-play.gif"> </a> </div> # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. - [x] Added/updated tests - [x] Manual QA for all new/changed functionality
32 lines
738 B
Go
32 lines
738 B
Go
package scepclient
|
|
|
|
import (
|
|
"time"
|
|
|
|
scepserver "github.com/fleetdm/fleet/v4/server/mdm/scep/server"
|
|
|
|
"github.com/go-kit/log"
|
|
"github.com/go-kit/log/level"
|
|
)
|
|
|
|
// Client is a SCEP Client
|
|
type Client interface {
|
|
scepserver.Service
|
|
Supports(cap string) bool
|
|
}
|
|
|
|
// New creates a SCEP Client.
|
|
func New(
|
|
serverURL string,
|
|
logger log.Logger,
|
|
timeout *time.Duration,
|
|
) (Client, error) {
|
|
endpoints, err := scepserver.MakeClientEndpoints(serverURL, timeout)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
logger = level.Info(logger)
|
|
endpoints.GetEndpoint = scepserver.EndpointLoggingMiddleware(logger)(endpoints.GetEndpoint)
|
|
endpoints.PostEndpoint = scepserver.EndpointLoggingMiddleware(logger)(endpoints.PostEndpoint)
|
|
return endpoints, nil
|
|
}
|