Skip to content

Commit be83128

Browse files
authored
Bring back web3 field #4935
ref DEV-2300
2 parents 3477e2b + 00a57c5 commit be83128

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

pkg/api/model/user.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@ import (
66

77
type User struct {
88
Meta
9-
LastLoginAt *time.Time `json:"last_login_at,omitempty"`
10-
IsAnonymous bool `json:"is_anonymous"`
11-
IsVerified bool `json:"is_verified"`
12-
IsDisabled bool `json:"is_disabled"`
13-
DisableReason *string `json:"disable_reason,omitempty"`
14-
IsDeactivated bool `json:"is_deactivated"`
15-
DeleteAt *time.Time `json:"delete_at,omitempty"`
16-
IsAnonymized bool `json:"is_anonymized"`
17-
AnonymizeAt *time.Time `json:"anonymize_at,omitempty"`
18-
CanReauthenticate bool `json:"can_reauthenticate"`
19-
StandardAttributes map[string]interface{} `json:"standard_attributes,omitempty"`
20-
CustomAttributes map[string]interface{} `json:"custom_attributes,omitempty"`
9+
LastLoginAt *time.Time `json:"last_login_at,omitempty"`
10+
IsAnonymous bool `json:"is_anonymous"`
11+
IsVerified bool `json:"is_verified"`
12+
IsDisabled bool `json:"is_disabled"`
13+
DisableReason *string `json:"disable_reason,omitempty"`
14+
IsDeactivated bool `json:"is_deactivated"`
15+
DeleteAt *time.Time `json:"delete_at,omitempty"`
16+
IsAnonymized bool `json:"is_anonymized"`
17+
AnonymizeAt *time.Time `json:"anonymize_at,omitempty"`
18+
CanReauthenticate bool `json:"can_reauthenticate"`
19+
StandardAttributes map[string]interface{} `json:"standard_attributes,omitempty"`
20+
CustomAttributes map[string]interface{} `json:"custom_attributes,omitempty"`
21+
// Web3 is kept for backwards compatibility purpose.
22+
// It is always an empty map.
23+
Web3 map[string]interface{} `json:"x_web3,omitempty"`
2124
Roles []string `json:"roles,omitempty"`
2225
Groups []string `json:"groups,omitempty"`
2326
MFAGracePeriodtEndAt *time.Time `json:"mfa_grace_period_end_at,omitempty"`

pkg/lib/authn/user/model.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,21 @@ func newUserModel(
320320
CreatedAt: user.CreatedAt,
321321
UpdatedAt: user.UpdatedAt,
322322
},
323-
LastLoginAt: user.MostRecentLoginAt,
324-
IsAnonymous: isAnonymous,
325-
IsVerified: isVerified,
326-
IsDisabled: user.IsDisabled,
327-
DisableReason: user.DisableReason,
328-
IsDeactivated: user.IsDeactivated,
329-
DeleteAt: user.DeleteAt,
330-
IsAnonymized: user.IsAnonymized,
331-
AnonymizeAt: user.AnonymizeAt,
332-
CanReauthenticate: canReauthenticate,
333-
StandardAttributes: derivedStandardAttributes,
334-
CustomAttributes: customAttributes,
323+
LastLoginAt: user.MostRecentLoginAt,
324+
IsAnonymous: isAnonymous,
325+
IsVerified: isVerified,
326+
IsDisabled: user.IsDisabled,
327+
DisableReason: user.DisableReason,
328+
IsDeactivated: user.IsDeactivated,
329+
DeleteAt: user.DeleteAt,
330+
IsAnonymized: user.IsAnonymized,
331+
AnonymizeAt: user.AnonymizeAt,
332+
CanReauthenticate: canReauthenticate,
333+
StandardAttributes: derivedStandardAttributes,
334+
CustomAttributes: customAttributes,
335+
// For backwards compatibility, we always output an empty object here.
336+
// The AdminAPI has marked this field non-null, so it MUST BE a map.
337+
Web3: make(map[string]interface{}),
335338
Roles: roles,
336339
Groups: groups,
337340
MFAGracePeriodtEndAt: user.MFAGracePeriodtEndAt,

pkg/lib/oauth/oidc/id_token.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ func (ti *IDTokenIssuer) GetUserInfo(ctx context.Context, userID string, clientL
272272
}
273273

274274
out["custom_attributes"] = user.CustomAttributes
275+
out["x_web3"] = user.Web3
275276
} else {
276277
// When the client is third party, we include the standard claims according to scopes.
277278
for k, v := range user.StandardAttributes {

0 commit comments

Comments
 (0)