Bootstrap Token (#781)

* Partial implementation of Bootstrap Token
Fetching the token from the db and sending it back to the client when the client asks for it ie sends the GetBootstrapTokenRequest is not implemented

Also earlier code for Bootstrap Token from commit 58c3782 "mdm: add SetBootstrapToken command." is removed

* implements rest of the bootstrap token feature - micromdm now sends bootstrap token back to the client, when client requests it

* regenerate some proto files

* use original proto generator versions
    checkin.pb.go: golang/protobuf@v1.2.0
    mdm.pb.go: gogo/protobuf@v1.3.2
    device.pb.go: golang/protobuf@v1.0.0

* cleanup syntax

* use more idiomatic naming

* clean up BootstrapToken storage

* add GetBootstrapToken test

* remove extra newline

Co-authored-by: Jesse Peterson <jessepeterson@users.noreply.github.com>

* add doc comments

Co-authored-by: Ilkka Vanhatalo <ilkka.vanhatalo@helsinki.fi>
Co-authored-by: Jesse Peterson <jessepeterson@users.noreply.github.com>
This commit is contained in:
Kory Prince
2021-10-05 12:43:46 -05:00
committed by GitHub
parent 6dc4facba0
commit fcf1d185fc
25 changed files with 751 additions and 413 deletions

View File

@@ -81,6 +81,16 @@ func (w *Worker) Run(ctx context.Context) error {
return errors.Wrapf(err, "subscribe %s to %s", subscription, mdm.CheckoutTopic)
}
getBootstrapTokenEvents, err := w.sub.Subscribe(ctx, subscription, mdm.GetBootstrapTokenTopic)
if err != nil {
return errors.Wrapf(err, "subscribe %s to %s", subscription, mdm.GetBootstrapTokenTopic)
}
setBootstrapTokenEvents, err := w.sub.Subscribe(ctx, subscription, mdm.SetBootstrapTokenTopic)
if err != nil {
return errors.Wrapf(err, "subscribe %s to %s", subscription, mdm.SetBootstrapTokenTopic)
}
for {
var (
event *Event
@@ -97,6 +107,10 @@ func (w *Worker) Run(ctx context.Context) error {
event, err = checkinEvent(ev.Topic, ev.Message)
case ev := <-checkoutEvents:
event, err = checkinEvent(ev.Topic, ev.Message)
case ev := <-getBootstrapTokenEvents:
event, err = checkinEvent(ev.Topic, ev.Message)
case ev := <-setBootstrapTokenEvents:
event, err = checkinEvent(ev.Topic, ev.Message)
}
if err != nil {