You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-07-17 01:42:36 +02:00
fix optional auth for middleware in session
This commit is contained in:
@ -107,7 +107,11 @@ func authenticateSession(authenticator *auth.Authenticator, required bool) web.M
|
||||
|
||||
claims, err := authenticator.ParseClaims(tknStr)
|
||||
if err != nil {
|
||||
return weberror.NewError(ctx, err, http.StatusUnauthorized)
|
||||
if required {
|
||||
return weberror.NewError(ctx, err, http.StatusUnauthorized)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Add claims to the context so they can be retrieved later.
|
||||
|
Reference in New Issue
Block a user