feat: bearer access token includes tokenid and subject

This commit is contained in:
Fabiennne 2020-10-13 13:18:11 +02:00
parent 49324646d7
commit bd3bdf32c5
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) {