feat: bearer access token includes tokenid and subject (#62)

This commit is contained in:
Fabi 2020-10-15 09:38:06 +02:00 committed by GitHub
parent 49324646d7
commit 9943f20215
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 11 deletions

View file

@ -73,12 +73,12 @@ func CreateAccessToken(ctx context.Context, authReq TokenRequest, accessTokenTyp
token, err = CreateJWT(creator.Issuer(), authReq, exp, id, creator.Signer())
return
}
token, err = CreateBearerToken(id, creator.Crypto())
token, err = CreateBearerToken(id, authReq.GetSubject(), creator.Crypto())
return
}
func CreateBearerToken(id string, crypto Crypto) (string, error) {
return crypto.Encrypt(id)
func CreateBearerToken(tokenID, subject string, crypto Crypto) (string, error) {
return crypto.Encrypt(tokenID + ":" + subject)
}
func CreateJWT(issuer string, authReq TokenRequest, exp time.Time, id string, signer Signer) (string, error) {