feat: include user ID with web token (#17535)
parent
02946a48a2
commit
5f1eaa7be3
|
@ -89,6 +89,8 @@ type Token struct {
|
||||||
KeyID string `json:"kid"`
|
KeyID string `json:"kid"`
|
||||||
// Permissions is the set of authorized permissions for the token
|
// Permissions is the set of authorized permissions for the token
|
||||||
Permissions []influxdb.Permission `json:"permissions"`
|
Permissions []influxdb.Permission `json:"permissions"`
|
||||||
|
// UserID for the token
|
||||||
|
UserID influxdb.ID `json:"uid,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allowed returns whether or not a permission is allowed based
|
// Allowed returns whether or not a permission is allowed based
|
||||||
|
@ -118,10 +120,9 @@ func (t *Token) Identifier() influxdb.ID {
|
||||||
return *id
|
return *id
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserID returns an invalid id as tokens are generated
|
// GetUserID returns the user ID for the token
|
||||||
// with permissions rather than for or by a particular user
|
|
||||||
func (t *Token) GetUserID() influxdb.ID {
|
func (t *Token) GetUserID() influxdb.ID {
|
||||||
return influxdb.InvalidID()
|
return t.UserID
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kind returns the string "jwt" which is used for auditing
|
// Kind returns the string "jwt" which is used for auditing
|
||||||
|
|
Loading…
Reference in New Issue