Use GetTokenID.

This commit is contained in:
Mariano Cano 2019-04-24 11:29:57 -07:00
parent 2c68915b70
commit 27c98806c0

View file

@ -64,14 +64,7 @@ func (a *Authority) authorizeToken(ott string) (provisioner.Interface, error) {
} }
// Store the token to protect against reuse. // Store the token to protect against reuse.
var reuseKey string if reuseKey, err := p.GetTokenID(ott); err == nil {
switch p.GetType() {
case provisioner.TypeJWK:
reuseKey = claims.ID
case provisioner.TypeOIDC:
reuseKey = claims.Nonce
}
if reuseKey != "" {
if _, ok := a.ottMap.LoadOrStore(reuseKey, &idUsed{ if _, ok := a.ottMap.LoadOrStore(reuseKey, &idUsed{
UsedAt: time.Now().Unix(), UsedAt: time.Now().Unix(),
Subject: claims.Subject, Subject: claims.Subject,