Documentation ¶
Overview ¶
Package api implements HTTP handlers for the NanoDEP API.
Index ¶
- Variables
- func DecryptTokenPKIHandler(store TokenPKIRetriever, tokenStore AuthTokensStore, logger log.Logger) http.HandlerFunc
- func GetCertTokenPKIHandler(store TokenPKIStorer, logger log.Logger) http.HandlerFunc
- func PEMRSAPrivateKey(key *rsa.PrivateKey) []byte
- func RetrieveAssignerProfileHandler(store sync.AssignerProfileRetriever, logger log.Logger) http.HandlerFunc
- func RetrieveAuthTokensHandler(store client.AuthTokensRetriever, logger log.Logger) http.HandlerFunc
- func RetrieveConfigHandler(store client.ConfigRetriever, logger log.Logger) http.HandlerFunc
- func StoreAssignerProfileHandler(store AssignerProfileStorer, logger log.Logger) http.HandlerFunc
- func StoreAuthTokensHandler(store AuthTokensStore, logger log.Logger) http.HandlerFunc
- func StoreConfigHandler(store ConfigStorer, logger log.Logger) http.HandlerFunc
- type AssignerProfileStorer
- type AuthTokensStore
- type AuthTokensStorer
- type ConfigStorer
- type TokenPKIRetriever
- type TokenPKIStorer
Constants ¶
This section is empty.
Variables ¶
var CKMismatch = errors.New("mismatched consumer key")
Functions ¶
func DecryptTokenPKIHandler ¶
func DecryptTokenPKIHandler(store TokenPKIRetriever, tokenStore AuthTokensStore, logger log.Logger) http.HandlerFunc
DecryptTokenPKIHandler reads the Apple-provided encrypted token ".p7m" file from the request body and decrypts it with the keypair generated from GetCertTokenPKIHandler.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
func GetCertTokenPKIHandler ¶
func GetCertTokenPKIHandler(store TokenPKIStorer, logger log.Logger) http.HandlerFunc
GetCertTokenPKIHandler generates a new private key and certificate for the token PKI exchange with the ABM/ASM/BE portal. Every call to this handler generates a new keypair and stores it. The PEM-encoded certificate is returned.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
func PEMRSAPrivateKey ¶
func PEMRSAPrivateKey(key *rsa.PrivateKey) []byte
PEMRSAPrivateKey returns key as a PEM block.
func RetrieveAssignerProfileHandler ¶
func RetrieveAssignerProfileHandler(store sync.AssignerProfileRetriever, logger log.Logger) http.HandlerFunc
RetrieveAssignerProfileHandler returns the assigner profile UUID for the given DEP name.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
func RetrieveAuthTokensHandler ¶
func RetrieveAuthTokensHandler(store client.AuthTokensRetriever, logger log.Logger) http.HandlerFunc
RetrieveAuthTokensHandler returns the DEP server OAuth1 tokens for the DEP name in the path.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
func RetrieveConfigHandler ¶
func RetrieveConfigHandler(store client.ConfigRetriever, logger log.Logger) http.HandlerFunc
RetrieveConfigHandler returns the DEP server config for the DEP name in the path.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
func StoreAssignerProfileHandler ¶
func StoreAssignerProfileHandler(store AssignerProfileStorer, logger log.Logger) http.HandlerFunc
StoreAssignerProfileHandler saves the assigner profile UUID for the given DEP name.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
func StoreAuthTokensHandler ¶
func StoreAuthTokensHandler(store AuthTokensStore, logger log.Logger) http.HandlerFunc
StoreAuthTokensHandler reads DEP server OAuth1 tokens as a JSON body and saves them using store.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
func StoreConfigHandler ¶
func StoreConfigHandler(store ConfigStorer, logger log.Logger) http.HandlerFunc
StoreConfigHandler stores the DEP server config for the DEP name in the path.
Note the whole URL path is used as the DEP name. This necessitates stripping the URL prefix before using this handler. Also note we expose Go errors to the output as this is meant for "API" users.
Types ¶
type AssignerProfileStorer ¶
type AuthTokensStore ¶ added in v0.1.1
type AuthTokensStore interface { client.AuthTokensRetriever AuthTokensStorer }