Skip to content

Commit 71d6d37

Browse files
committed
feature: enable users to pass a Logger via Options
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
1 parent a90e562 commit 71d6d37

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ginoauth2.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type AccessCheckFunction func(tc *TokenContainer, ctx *gin.Context) bool
9191
type Options struct {
9292
Endpoint oauth2.Endpoint
9393
AccessTokenInHeader bool
94+
Log Logger
9495
}
9596

9697
var accessTokenMask = regexp.MustCompile("[?&]access_token=[^&]+")
@@ -289,6 +290,7 @@ func AuthChain(endpoint oauth2.Endpoint, accessCheckFunctions ...AccessCheckFunc
289290
func AuthChainOptions(o Options, accessCheckFunctions ...AccessCheckFunction) gin.HandlerFunc {
290291
// init
291292
AuthInfoURL = o.Endpoint.TokenURL
293+
DefaultLogger = o.Log
292294
// middleware
293295
return func(ctx *gin.Context) {
294296
t := time.Now()

0 commit comments

Comments
 (0)