fixed transaction issues
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package jwt
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -9,7 +10,7 @@ import (
|
||||
// all the claims, including checking if it is expired, has a valid issuer, and
|
||||
// has the correct scope.
|
||||
func (gen *TokenGenerator) ValidateAccess(
|
||||
ctx context.Context,
|
||||
tx *sql.Tx,
|
||||
tokenString string,
|
||||
) (*AccessToken, error) {
|
||||
if tokenString == "" {
|
||||
@@ -64,10 +65,10 @@ func (gen *TokenGenerator) ValidateAccess(
|
||||
Fresh: fresh,
|
||||
JTI: jti,
|
||||
Scope: scope,
|
||||
db: gen.dbConn,
|
||||
gen: gen,
|
||||
}
|
||||
|
||||
valid, err := token.CheckNotRevoked(ctx)
|
||||
valid, err := token.CheckNotRevoked(tx)
|
||||
if err != nil && gen.dbConn != nil {
|
||||
return nil, errors.Wrap(err, "token.CheckNotRevoked")
|
||||
}
|
||||
@@ -81,7 +82,7 @@ func (gen *TokenGenerator) ValidateAccess(
|
||||
// all the claims, including checking if it is expired, has a valid issuer, and
|
||||
// has the correct scope.
|
||||
func (gen *TokenGenerator) ValidateRefresh(
|
||||
ctx context.Context,
|
||||
tx *sql.Tx,
|
||||
tokenString string,
|
||||
) (*RefreshToken, error) {
|
||||
if tokenString == "" {
|
||||
@@ -131,10 +132,10 @@ func (gen *TokenGenerator) ValidateRefresh(
|
||||
SUB: subject,
|
||||
JTI: jti,
|
||||
Scope: scope,
|
||||
db: gen.dbConn,
|
||||
gen: gen,
|
||||
}
|
||||
|
||||
valid, err := token.CheckNotRevoked(ctx)
|
||||
valid, err := token.CheckNotRevoked(tx)
|
||||
if err != nil && gen.dbConn != nil {
|
||||
return nil, errors.Wrap(err, "token.CheckNotRevoked")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user