The "sub" (subject) claim identifies the principal that is the
subject of the JWT. The claims in a JWT are normally statements
about the subject. The subject value MUST either be scoped to be
locally unique in the context of the issuer or be globally unique.
The processing of this claim is generally application specific. The
"sub" value is a case-sensitive string containing a StringOrURI
value. Use of this claim is OPTIONAL.
This is exactly what we use the username claim for at the moment. It would be better to use the proposed claim of sub for this purpose.
RFC 7519 Section 4.1.2 states
This is exactly what we use the
username
claim for at the moment. It would be better to use the proposed claim ofsub
for this purpose.Proposed JWT structure