mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 01:07:41 +08:00
initial commit
This commit is contained in:
@@ -3,6 +3,7 @@ package command
|
||||
import (
|
||||
"crypto/ed25519"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -18,6 +19,25 @@ import (
|
||||
func Join(cfg *config.ClientConfig, privateKey string) error {
|
||||
var err error
|
||||
//join network
|
||||
if cfg.SsoServer != "" {
|
||||
// User wants to get access key from the OIDC server
|
||||
// Do that before the Joining Network flow by performing the end point auth flow
|
||||
// if performed successfully an access key is obtained from the server and then we
|
||||
// proceed with the usual flow 'pretending' that user is feeded us with an access token
|
||||
logger.Log(1, "Logging into %s via:", cfg.Network, cfg.SsoServer)
|
||||
err = functions.JoinViaSSo(cfg, privateKey)
|
||||
if err != nil {
|
||||
logger.Log(0, "Join via OIDC failed: ", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.AccessKey == "" {
|
||||
return errors.New("failed to get access key")
|
||||
}
|
||||
logger.Log(1, "Got an access key to ", cfg.Network, " via:", cfg.SsoServer)
|
||||
}
|
||||
|
||||
logger.Log(1, "Joining network: ", cfg.Network)
|
||||
err = functions.JoinNetwork(cfg, privateKey)
|
||||
if err != nil {
|
||||
if !strings.Contains(err.Error(), "ALREADY_INSTALLED") {
|
||||
|
Reference in New Issue
Block a user