WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit ee1ad14

Browse files
committed
Add endpoint oidc email to enroll response
1 parent 7df0fd4 commit ee1ad14

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

client.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ var ErrInvalidCredentials = fmt.Errorf("invalid credentials")
8383
var ErrInvalidCode = fmt.Errorf("invalid enrollment code")
8484

8585
type ConfigMeta struct {
86-
Org ConfigOrg
87-
Network ConfigNetwork
88-
Host ConfigHost
86+
Org ConfigOrg
87+
Network ConfigNetwork
88+
Host ConfigHost
89+
EndpointOIDC ConfigEndpointOIDC
8990
}
9091

9192
type ConfigOrg struct {
@@ -104,6 +105,10 @@ type ConfigHost struct {
104105
IPAddress string
105106
}
106107

108+
type ConfigEndpointOIDC struct {
109+
Email *string
110+
}
111+
107112
// Enroll issues an enrollment request against the REST API using the given enrollment code, passing along a locally
108113
// generated DH X25519 public key to be signed by the CA, and an Ed 25519 public key for future API call authentication.
109114
// On success it returns the Nebula config generated by the server, a Nebula private key PEM to be inserted into the
@@ -202,6 +207,9 @@ func (c *Client) Enroll(ctx context.Context, logger logrus.FieldLogger, code str
202207
Name: r.Data.Host.Name,
203208
IPAddress: r.Data.Host.IPAddress,
204209
},
210+
EndpointOIDC: ConfigEndpointOIDC{
211+
Email: r.Data.EndpointOIDCMeta.Email,
212+
},
205213
}
206214

207215
// Determine the private keys to save based on the network curve type

message/message.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,14 @@ type EnrollResponse struct {
152152

153153
// EnrollResponseData is included in the EnrollResponse.
154154
type EnrollResponseData struct {
155-
Config []byte `json:"config"`
156-
HostID string `json:"hostID"`
157-
Counter uint `json:"counter"`
158-
TrustedKeys []byte `json:"trustedKeys"`
159-
Organization HostOrgMetadata `json:"organization"`
160-
Network HostNetworkMetadata `json:"network"`
161-
Host HostHostMetadata `json:"host"`
155+
Config []byte `json:"config"`
156+
HostID string `json:"hostID"`
157+
Counter uint `json:"counter"`
158+
TrustedKeys []byte `json:"trustedKeys"`
159+
Organization HostOrgMetadata `json:"organization"`
160+
Network HostNetworkMetadata `json:"network"`
161+
Host HostHostMetadata `json:"host"`
162+
EndpointOIDCMeta *HostEndpointOIDCMetadata `json:"endpointOIDC,omitempty"`
162163
}
163164

164165
// HostOrgMetadata is included in EnrollResponseData.
@@ -182,6 +183,11 @@ type HostHostMetadata struct {
182183
IPAddress string `json:"ipAddress"`
183184
}
184185

186+
// HostEndpointOIDCMetadata is included in EnrollResponseData.
187+
type HostEndpointOIDCMetadata struct {
188+
Email *string `json:"email"`
189+
}
190+
185191
// APIError represents a single error returned in an API error response.
186192
type APIError struct {
187193
Code string `json:"code"`

0 commit comments

Comments
 (0)