I am trying to use Passenger's request variable within my Rails middleware so I can send information to an OmniAuth strategy:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :casmate, {
:setup => true,
:dn => request.env['SSL_CLIENT_S_DN']
}
end
but "request" isn't recognized within the middleware. Is there a way to do this within the middleware, or is there a way to invoke the middleware in a controller and pass in the same symbols (:casmate, :setup, :dn)?
Thanks for your help.
I don't know how to use the request.env variable within a middleware initializer, but if you want to send any information, you can do so within the options hash by:
request.env['omniauth.strategy'].options[:dn] = request.env['SSL_CLIENT_S_DN']
inside of your controller.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.