Add controller-led worker auth flow (#2413)
This adds an action to the API that allows pulling out an activation token that can be given to a worker in its config (directly or via env or file). The worker can pass this along with its normal request in place of its normal nonce and the server will automatically accept it. Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>
This commit is contained in:
1 parent
a1be125f5b
commit
01fb949d0b
55 files changed
+2728
-625
No files matched your search
@@ -67,13 +67,16 @@ type Worker struct {
|
||||
// other based on the context in which the worker is passed. As such
|
||||
// inputTags should only be read when performing mutations on the database.
|
||||
inputTags []*Tag `gorm:"-"`
|
||||
|
||||
// This is used to pass the token back to the calling function
|
||||
ControllerGeneratedActivationToken string `gorm:"-"`
|
||||
}
|
||||
|
||||
// NewWorker returns a new Worker. Valid options are WithName, WithDescription
|
||||
// WithAddress, and WithWorkerTags. All other options are ignored. This does
|
||||
// not set any of the worker reported values.
|
||||
func NewWorker(scopeId string, opt ...Option) *Worker {
|
||||
opts := getOpts(opt...)
|
||||
opts := GetOpts(opt...)
|
||||
return &Worker{
|
||||
Worker: &store.Worker{
|
||||
ScopeId: scopeId,
|
||||
|
||||
Reference in new issue
Block a user