api

package
v0.17.3-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 24 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler added in v0.15.12

func NewHandler(ops HandlerOptions) api.RouterHandler

NewHandler returns a new ACME API handler.

Types

type Clock added in v0.15.12

type Clock struct{}

Clock that returns time in UTC rounded to seconds.

func (*Clock) Now added in v0.15.12

func (c *Clock) Now() time.Time

Now returns the UTC time rounded to seconds.

type ContextKey added in v0.15.12

type ContextKey string

ContextKey is the key type for storing and searching for ACME request essentials in the context of a request.

type Directory added in v0.15.12

type Directory struct {
	NewNonce   string `json:"newNonce"`
	NewAccount string `json:"newAccount"`
	NewOrder   string `json:"newOrder"`
	RevokeCert string `json:"revokeCert"`
	KeyChange  string `json:"keyChange"`
}

Directory represents an ACME directory for configuring clients.

func (*Directory) ToLog added in v0.15.12

func (d *Directory) ToLog() (interface{}, error)

ToLog enables response logging for the Directory type.

type FinalizeRequest

type FinalizeRequest struct {
	CSR string `json:"csr"`
	// contains filtered or unexported fields
}

FinalizeRequest captures the body for a Finalize order request.

func (*FinalizeRequest) Validate

func (f *FinalizeRequest) Validate() error

Validate validates a finalize request body.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is the ACME API request handler.

func (*Handler) FinalizeOrder

func (h *Handler) FinalizeOrder(w http.ResponseWriter, r *http.Request)

FinalizeOrder attemptst to finalize an order and create a certificate.

func (*Handler) GetAuthorization added in v0.15.12

func (h *Handler) GetAuthorization(w http.ResponseWriter, r *http.Request)

GetAuthorization ACME api for retrieving an Authz.

func (*Handler) GetCertificate

func (h *Handler) GetCertificate(w http.ResponseWriter, r *http.Request)

GetCertificate ACME api for retrieving a Certificate.

func (*Handler) GetChallenge

func (h *Handler) GetChallenge(w http.ResponseWriter, r *http.Request)

GetChallenge ACME api for retrieving a Challenge.

func (*Handler) GetDirectory

func (h *Handler) GetDirectory(w http.ResponseWriter, r *http.Request)

GetDirectory is the ACME resource for returning a directory configuration for client configuration.

func (*Handler) GetNonce

func (h *Handler) GetNonce(w http.ResponseWriter, r *http.Request)

GetNonce just sets the right header since a Nonce is added to each response by middleware by default.

func (*Handler) GetOrUpdateAccount added in v0.15.12

func (h *Handler) GetOrUpdateAccount(w http.ResponseWriter, r *http.Request)

GetOrUpdateAccount is the api for updating an ACME account.

func (*Handler) GetOrder

func (h *Handler) GetOrder(w http.ResponseWriter, r *http.Request)

GetOrder ACME api for retrieving an order.

func (*Handler) GetOrdersByAccountID added in v0.15.12

func (h *Handler) GetOrdersByAccountID(w http.ResponseWriter, r *http.Request)

GetOrdersByAccountID ACME api for retrieving the list of order urls belonging to an account.

func (*Handler) NewAccount

func (h *Handler) NewAccount(w http.ResponseWriter, r *http.Request)

NewAccount is the handler resource for creating new ACME accounts.

func (*Handler) NewOrder

func (h *Handler) NewOrder(w http.ResponseWriter, r *http.Request)

NewOrder ACME api for creating a new order.

func (*Handler) NotImplemented added in v0.14.5

func (h *Handler) NotImplemented(w http.ResponseWriter, r *http.Request)

NotImplemented returns a 501 and is generally a placeholder for functionality which MAY be added at some point in the future but is not in any way a guarantee of such.

func (*Handler) Route

func (h *Handler) Route(r api.Router)

Route traffic and implement the Router interface.

type HandlerOptions added in v0.15.12

type HandlerOptions struct {
	Backdate provisioner.Duration
	// DB storage backend that impements the acme.DB interface.
	DB acme.DB
	// DNS the host used to generate accurate ACME links. By default the authority
	// will use the Host from the request, so this value will only be used if
	// request.Host is empty.
	DNS string
	// Prefix is a URL path prefix under which the ACME api is served. This
	// prefix is required to generate accurate ACME links.
	// E.g. https://ca.smallstep.com/acme/my-acme-provisioner/new-account --
	// "acme" is the prefix from which the ACME api is accessed.
	Prefix string
	CA     acme.CertificateAuthority
}

HandlerOptions required to create a new ACME API request handler.

type LinkType added in v0.15.12

type LinkType int

LinkType captures the link type.

const (
	// NewNonceLinkType new-nonce
	NewNonceLinkType LinkType = iota
	// NewAccountLinkType new-account
	NewAccountLinkType
	// AccountLinkType account
	AccountLinkType
	// OrderLinkType order
	OrderLinkType
	// NewOrderLinkType new-order
	NewOrderLinkType
	// OrdersByAccountLinkType list of orders owned by account
	OrdersByAccountLinkType
	// FinalizeLinkType finalize order
	FinalizeLinkType
	// NewAuthzLinkType authz
	NewAuthzLinkType
	// AuthzLinkType new-authz
	AuthzLinkType
	// ChallengeLinkType challenge
	ChallengeLinkType
	// CertificateLinkType certificate
	CertificateLinkType
	// DirectoryLinkType directory
	DirectoryLinkType
	// RevokeCertLinkType revoke certificate
	RevokeCertLinkType
	// KeyChangeLinkType key rollover
	KeyChangeLinkType
)

func (LinkType) String added in v0.15.12

func (l LinkType) String() string

type Linker added in v0.15.12

type Linker interface {
	GetLink(ctx context.Context, typ LinkType, inputs ...string) string
	GetUnescapedPathSuffix(typ LinkType, provName string, inputs ...string) string

	LinkOrder(ctx context.Context, o *acme.Order)
	LinkAccount(ctx context.Context, o *acme.Account)
	LinkChallenge(ctx context.Context, o *acme.Challenge, azID string)
	LinkAuthorization(ctx context.Context, o *acme.Authorization)
	LinkOrdersByAccountID(ctx context.Context, orders []string)
}

Linker interface for generating links for ACME resources.

func NewLinker added in v0.15.12

func NewLinker(dns, prefix string) Linker

NewLinker returns a new Directory type.

type NewAccountRequest

type NewAccountRequest struct {
	Contact              []string `json:"contact"`
	OnlyReturnExisting   bool     `json:"onlyReturnExisting"`
	TermsOfServiceAgreed bool     `json:"termsOfServiceAgreed"`
}

NewAccountRequest represents the payload for a new account request.

func (*NewAccountRequest) Validate

func (n *NewAccountRequest) Validate() error

Validate validates a new-account request body.

type NewOrderRequest

type NewOrderRequest struct {
	Identifiers []acme.Identifier `json:"identifiers"`
	NotBefore   time.Time         `json:"notBefore,omitempty"`
	NotAfter    time.Time         `json:"notAfter,omitempty"`
}

NewOrderRequest represents the body for a NewOrder request.

func (*NewOrderRequest) Validate

func (n *NewOrderRequest) Validate() error

Validate validates a new-order request body.

type UpdateAccountRequest

type UpdateAccountRequest struct {
	Contact []string    `json:"contact"`
	Status  acme.Status `json:"status"`
}

UpdateAccountRequest represents an update-account request.

func (*UpdateAccountRequest) Validate

func (u *UpdateAccountRequest) Validate() error

Validate validates a update-account request body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL