Skip to content

Commit

Permalink
Merge pull request #146 from croessner/features
Browse files Browse the repository at this point in the history
Fix: Add Redis dependency and check user existence with Redis
  • Loading branch information
croessner authored Oct 30, 2024
2 parents 5738eb3 + 5f89fb7 commit eca0253
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/core/hydra.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
openapi "github.com/ory/hydra-client-go/v2"
"github.com/pquerna/otp"
"github.com/pquerna/otp/totp"
"github.com/redis/go-redis/v9"
"github.com/spf13/viper"
"golang.org/x/text/cases"
"golang.org/x/text/language"
Expand Down Expand Up @@ -1640,6 +1641,13 @@ func (a *ApiConfig) logFailedLoginAndRedirect(auth *AuthState) {

// runLuaFilterAndPost filters and executes post-action Lua scripts based on the given post-2FA authentication result.
func runLuaFilterAndPost(ctx *gin.Context, auth *AuthState, authResult global.AuthResult) global.AuthResult {
userFound, err := auth.userExists()
if err != nil {
if !stderrors.Is(err, redis.Nil) {
level.Error(log.Logger).Log(global.LogKeyGUID, auth.GUID, global.LogKeyError, err)
}
}

passDBResult := &PassDBResult{
Authenticated: func() bool {
if authResult == global.AuthResultOK {
Expand All @@ -1648,7 +1656,7 @@ func runLuaFilterAndPost(ctx *gin.Context, auth *AuthState, authResult global.Au

return false
}(),
UserFound: auth.UserFound,
UserFound: userFound,
}

authResult = auth.filterLua(passDBResult, ctx)
Expand Down

0 comments on commit eca0253

Please sign in to comment.