config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigTopic = "mdm.ServerConfigUpdated"
View Source
const DEPTokenTopic = "mdm.TokenAdded"

Variables

This section is empty.

Functions

func MakeApplyDEPTokensEndpoint

func MakeApplyDEPTokensEndpoint(svc Service) endpoint.Endpoint

func MakeGetDEPTokensEndpoint

func MakeGetDEPTokensEndpoint(svc Service) endpoint.Endpoint

func MakeGetPushCertificateEndpoint

func MakeGetPushCertificateEndpoint(svc Service) endpoint.Endpoint

func MakeSavePushCertificateEndpoint

func MakeSavePushCertificateEndpoint(svc Service) endpoint.Endpoint

func MarshalServerConfig

func MarshalServerConfig(conf *ServerConfig) ([]byte, error)

func RegisterHTTPHandlers

func RegisterHTTPHandlers(r *mux.Router, e Endpoints, options ...httptransport.ServerOption)

func UnmarshalServerConfig

func UnmarshalServerConfig(data []byte, conf *ServerConfig) error

Types

type ConfigService

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

func New

func New(store Store) *ConfigService

func (*ConfigService) ApplyDEPToken

func (svc *ConfigService) ApplyDEPToken(ctx context.Context, P7MContent []byte) error

func (*ConfigService) GetDEPTokens

func (svc *ConfigService) GetDEPTokens(ctx context.Context) ([]DEPToken, []byte, error)

func (*ConfigService) GetPushCertificate

func (svc *ConfigService) GetPushCertificate(ctx context.Context) ([]byte, error)

func (*ConfigService) SavePushCertificate

func (svc *ConfigService) SavePushCertificate(ctx context.Context, cert, key []byte) error

type DEPToken

type DEPToken struct {
	ConsumerKey       string    `json:"consumer_key"`
	ConsumerSecret    string    `json:"consumer_secret"`
	AccessToken       string    `json:"access_token"`
	AccessSecret      string    `json:"access_secret"`
	AccessTokenExpiry time.Time `json:"access_token_expiry"`
}

func (DEPToken) Client

func (tok DEPToken) Client() (*dep.Client, error)

create a DEP client from token.

type Endpoints

type Endpoints struct {
	SavePushCertificateEndpoint endpoint.Endpoint
	GetPushCertificateEndpoint  endpoint.Endpoint
	ApplyDEPTokensEndpoint      endpoint.Endpoint
	GetDEPTokensEndpoint        endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service, outer endpoint.Middleware, others ...endpoint.Middleware) Endpoints

func (Endpoints) ApplyDEPToken

func (e Endpoints) ApplyDEPToken(ctx context.Context, P7MContent []byte) error

func (Endpoints) GetDEPTokens

func (e Endpoints) GetDEPTokens(ctx context.Context) ([]DEPToken, []byte, error)

func (Endpoints) GetPushCertificate

func (e Endpoints) GetPushCertificate(ctx context.Context) ([]byte, error)

func (Endpoints) SavePushCertificate

func (e Endpoints) SavePushCertificate(ctx context.Context, cert, key []byte) error

type ServerConfig

type ServerConfig struct {
	PushCertificate []byte
	PrivateKey      []byte
}

ServerConfig holds the configuration of the MDM Server.

type Service

type Service interface {
	SavePushCertificate(ctx context.Context, cert, key []byte) error
	GetPushCertificate(ctx context.Context) ([]byte, error)
	ApplyDEPToken(ctx context.Context, P7MContent []byte) error
	GetDEPTokens(ctx context.Context) ([]DEPToken, []byte, error)
}

func NewHTTPClient

func NewHTTPClient(instance, token string, logger log.Logger, opts ...httptransport.ClientOption) (Service, error)

type Store

type Store interface {
	SavePushCertificate(cert, key []byte) error
	GetPushCertificate() ([]byte, error)
	PushCertificate() (*tls.Certificate, error)
	PushTopic() (string, error)
	DEPKeypair() (key *rsa.PrivateKey, cert *x509.Certificate, err error)
	AddToken(consumerKey string, json []byte) error
	DEPTokens() ([]DEPToken, error)
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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