FIX: Convert omniauth authenticator names to symbols before comparing

FIX: Convert omniauth authenticator names to symbols before comparing

This is necessary because some auth plugins define their name as a string

diff --git a/lib/middleware/omniauth_bypass_middleware.rb b/lib/middleware/omniauth_bypass_middleware.rb
index 92f3c97..4a32730 100644
--- a/lib/middleware/omniauth_bypass_middleware.rb
+++ b/lib/middleware/omniauth_bypass_middleware.rb
@@ -28,7 +28,7 @@ class Middleware::OmniauthBypassMiddleware
       CSRFTokenVerifier.new.call(env) if request.request_method.downcase.to_sym != :get
 
       # Check whether the authenticator is enabled
-      if !Discourse.enabled_authenticators.any? { |a| a.name == env['omniauth.strategy'].name }
+      if !Discourse.enabled_authenticators.any? { |a| a.name.to_sym == env['omniauth.strategy'].name.to_sym }
         raise AuthenticatorDisabled
       end

GitHub sha: f4aa6096

1 Like