- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 Rails 应用程序,它使用 devise 来验证用户,然后在调用 sinatra 应用程序之前由中间件检查 session /管理员用户,我的 config.ru 在下面。
这在直接从服务器请求应用程序时效果很好,例如 https://server1.com/tar
但是如果我通过反向代理请求相同的 URL,例如 https://server2.com/tar中间件应用程序查找 env['warden'].user 并返回 nil。
当请求通过反向代理时,env['warden'].user 无法再从 check_permission.rb(如下)访问。
我已经包含了中间件从 server1(无代理)和 server2(代理)接收到的请求的差异 - 长字符串已用“...”缩短
任何帮助都会很棒
config.ru
require ::File.expand_path('../config/environment', __FILE__)
require 'sinatra_tar'
appurl = ENV['RAILS_RELATIVE_URL_ROOT'] || '/'
map appurl do
run Rails.application
end
map "#{appurl}/tar" do
use RailsEnvConfigMiddleware
use ActionDispatch::Session::CookieStore, :key => ENV['SESSION_STORE'] + '_session',
:path => '/', :secret => ENV['SECRET_KEY_BASE']
use Warden::Manager do |manager|
manager.failure_app = WardenFailure
manager.default_scope = Devise.default_scope
end
use CheckPermission
run Sinatra::Application
end
check_permission.rb
class CheckPermission
def initialize(app)
@app = app
end
def call(env)
@app.call env
if !env['warden'].nil? && !env['warden'].user.nil?
user = env['warden'].user
Log.info "Found warden user=#{user}"
end
end
end
请求 server1 diff(无代理)
"HTTP_X_REAL_IP"=>"140.251.30.49",
"HTTP_REFERER"=>"https://server1.com/pubshare_staging/data_browser",
"HTTP_COOKIE"=>"_pubshare_pubshare_staging_session=aTl...",
"rack.hijack"=>#<Puma::Client:0x3fc1c37d9834 @ready=true>,
"rack.session"=>#<ActionDispatch::Request::Session:0x7f8386fb28e8 not yet loaded>,
"rack.session.options"=>#<ActionDispatch::Request::Session::Options:0x007f8386fb2898 @by=#<ActionDispatch::Session::CookieStore:0x00000005b420a8 @app=#<Warden::Manager:0x00000005b42170 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure}, @app=#<CheckPermission:0x00000005b42198 @app=Sinatra::Application>>, @default_options={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}, @key="_pubshare_pubshare_staging_session", @cookie_only=true>, @env={...}, @delegate={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}>,
"warden"=>Warden::Proxy:70101441025040 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure},
"rack.logger"=>#<Logger:0x007f8386f872d8 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x007f8386f872b0 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007f8386f87260 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007f8386f87238 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007f8386f871e8>>>>,
"HTTP_X_REAL_IP"=>"140.251.30.49",
"HTTP_REFERER"=>"https://server1.com/pubshare_staging/data_browser",
"HTTP_COOKIE"=>"_pubshare_pubshare_staging_session=aTl...",
"rack.hijack"=>#<Puma::Client:0x3fc1c37d9834 @ready=true>,
"rack.session"=>#<ActionDispatch::Request::Session:0x007f8386fb28e8 @by=#<ActionDispatch::Session::CookieStore:0x00000005b420a8 @app=#<Warden::Manager:0x00000005b42170 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure}, @app=#<CheckPermission:0x00000005b42198 @app=Sinatra::Application>>, @default_options={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}, @key="_pubshare_pubshare_staging_session", @cookie_only=true>, @env={...}, @delegate={"session_id"=>"5c72943e6df4095ef08ac9c7c65c6f4e",
"warden.user.user.key"=>[[2],
"$2a$10$Y46GsGR.nGaWDWfFYnCA4e"],
"warden.user.user.session"=>{"last_request_at"=>1453684735},
"_csrf_token"=>"nzR6FefPfQ3hXyJ7oKvNoJUIpzjYl8nOv6yhhlvU+88="}, @loaded=true, @exists=true>,
"rack.session.options"=>#<ActionDispatch::Request::Session::Options:0x007f8386fb2898 @by=#<ActionDispatch::Session::CookieStore:0x00000005b420a8 @app=#<Warden::Manager:0x00000005b42170 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure}, @app=#<CheckPermission:0x00000005b42198 @app=Sinatra::Application>>, @default_options={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}, @key="_pubshare_pubshare_staging_session", @cookie_only=true>, @env={...}, @delegate={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612...", :id=>"5c72943e6df4095ef08ac9c7c65c6f4e"}>,
"warden"=>Warden::Proxy:70101441025040 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure},
"sinatra.commonlogger"=>true,
"rack.logger"=>#<Logger:0x007f8386d94ae8 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x007f8386d94ac0 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007f8386d94a70 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007f8386d94a48 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007f8386d949f8>>>>,
"rack.request.query_string"=>"",
"rack.request.query_hash"=>{},
"sinatra.route"=>"GET /:downloadable_id/:path/:dataset_id/:project_id/:sample_name/*.fastq.gz",
"rack.request.cookie_hash"=>{"_pubshare_pubshare_staging_session"=>"aTl..."},
"rack.request.cookie_string"=>"_pubshare_pubshare_staging_session=aTl...",
"action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x007f8386f5c998 @key_generator=#<ActiveSupport::CachingKeyGenerator:0x00000004beeae8 @key_generator=#<ActiveSupport::KeyGenerator:0x00000004beebb0 @secret="ENV['SECRET_KEY_BASE']", @iterations=1000>, @cache_keys=#<ThreadSafe::Cache:0x00000004bee7a0 @backend={"signed_global_ids64"=>"\xF..."}, @default_proc=nil>>, @set_cookies={}, @delete_cookies={}, @host="server1.com", @secure=true, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @cookies={"_pubshare_pubshare_staging_session"=>"aTl..."}, @committed=false, @encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007f8386f5c268 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007f8386f5c998 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007f8386f5c100 @secret="e\x...", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007f8386f5c038 @secret="\xC...", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=ActiveSupport::MessageEncryptor::NullSerializer>>, @signed_or_encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007f8386f5c268 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007f8386f5c998 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007f8386f5c100 @secret="e\x...", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007f8386f5c038 @secret="\xCEGz\vNo\x87F\x9E\xD8\x1A>w:^?\xD4\x90\xD7/\xD9/,\x88i \x0F\x96&\xBEz\x06\xA9K\xB6\x8C5\xB6\e\x04\xCE\xE8l*\x87\xB0,3+\xBD72V\xE7\x15MW\xFBO\x9D'\xCB\xD2\xC1", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=ActiveSupport::MessageEncryptor::NullSerializer>>>,
"action_dispatch.request.unsigned_session_cookie"=>{"session_id"=>"5c72943e6df4095ef08ac9c7c65c6f4e",
"warden.user.user.key"=>[[2],
"$2a$10$Y46GsGR.nGaWDWfFYnCA4e"],
"warden.user.user.session"=>{"last_request_at"=>1453684735},
"_csrf_token"=>"nzR6FefPfQ3hXyJ7oKvNoJUIpzjYl8nOv6yhhlvU+88="}
请求 server2 diff(代理)
"HTTP_X_REAL_IP"=>"157.139.217.14",
"HTTP_REFERER"=>"https://server2.com/pubshare_staging/data_browser",
"HTTP_COOKIE"=>"_pubshare_pubshare_staging_session=ZFd...",
"HTTP_X_FORWARDED_FOR"=>"140.251.30.49",
"HTTP_X_FORWARDED_HOST"=>"server2.com",
"HTTP_X_FORWARDED_SERVER"=>"server2.com",
"rack.hijack"=>#<Puma::Client:0x3fc1c3969b68 @ready=true>,
"rack.session"=>#<ActionDispatch::Request::Session:0x007f83872d2a28 @by=#<ActionDispatch::Session::CookieStore:0x00000005b420a8 @app=#<Warden::Manager:0x00000005b42170 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure}, @app=#<CheckPermission:0x00000005b42198 @app=Sinatra::Application>>, @default_options={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}, @key="_pubshare_pubshare_staging_session", @cookie_only=true>, @env={...}, @delegate={}, @loaded=true, @exists=nil>,
"rack.session.options"=>#<ActionDispatch::Request::Session::Options:0x007f83872d29d8 @by=#<ActionDispatch::Session::CookieStore:0x00000005b420a8 @app=#<Warden::Manager:0x00000005b42170 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure}, @app=#<CheckPermission:0x00000005b42198 @app=Sinatra::Application>>, @default_options={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}, @key="_pubshare_pubshare_staging_session", @cookie_only=true>, @env={...}, @delegate={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612...", :id=>"b91f3dc2220bace810524ed4400f6150"}>,
"warden"=>Warden::Proxy:70101442663600 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure},
"rack.logger"=>#<Logger:0x007f83872d2208 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x007f83872d21e0 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007f83872d2190 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007f83872d2168 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007f83872d2118>>>>,
"rack.request.cookie_hash"=>{"_pubshare_pubshare_staging_session"=>"ZFd..."},
"rack.request.cookie_string"=>"_pubshare_pubshare_staging_session=ZFd...",
"action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x007f83872d1c40 @key_generator=#<ActiveSupport::CachingKeyGenerator:0x00000004beeae8 @key_generator=#<ActiveSupport::KeyGenerator:0x00000004beebb0 @secret="ENV['SECRET_KEY_BASE']", @iterations=1000>, @cache_keys=#<ThreadSafe::Cache:0x00000004bee7a0 @backend={"signed_global_ids64"=>"\xF...",
"signed encrypted cookie64"=>"\xC..."}, @default_proc=nil>>, @set_cookies={}, @delete_cookies={}, @host="server2.com", @secure=true, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @cookies={"_pubshare_pubshare_staging_session"=>"ZFd..."}, @committed=false, @encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007f83872d14c0 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007f83872d1c40 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007f83872d1358 @secret="e\x...", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007f83872d1290 @secret="\xC...", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=ActiveSupport::MessageEncryptor::NullSerializer>>, @signed_or_encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007f83872d14c0 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007f83872d1c40 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007f83872d1358 @secret="e\x...", @sign_secret="\xCEGz\vNo\x87F\x9E\xD8\x1A>w:^?\xD4\x90\xD7/\xD9/,\x88i \x0F\x96&\xBEz\x06\xA9K\xB6\x8C5\xB6\e\x04\xCE\xE8l*\x87\xB0,3+\xBD72V\xE7\x15MW\xFBO\x9D'\xCB\xD2\xC1", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007f83872d1290 @secret="\xCEGz\vNo\x87F\x9E\xD8\x1A>w:^?\xD4\x90\xD7/\xD9/,\x88i \x0F\x96&\xBEz\x06\xA9K\xB6\x8C5\xB6\e\x04\xCE\xE8l*\x87\xB0,3+\xBD72V\xE7\x15MW\xFBO\x9D'\xCB\xD2\xC1", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=ActiveSupport::MessageEncryptor::NullSerializer>>>,
"action_dispatch.request.unsigned_session_cookie"=>{"session_id"=>"b91f3dc2220bace810524ed4400f6150",
"warden.user.user.key"=>[[2],
"$2a$10$Y46GsGR.nGaWDWfFYnCA4e"],
"warden.user.user.session"=>{"last_request_at"=>1453684930},
"_csrf_token"=>"sY2HCre1HnZP05TEAsBZ4C8jHi9z2eIipXG2s4YYX2s="},
"HTTP_X_REAL_IP"=>"157.139.217.14",
"HTTP_REFERER"=>"https://server2.com/pubshare_staging/data_browser",
"HTTP_COOKIE"=>"_pubshare_pubshare_staging_session=ZFd...",
"HTTP_X_FORWARDED_FOR"=>"140.251.30.49",
"HTTP_X_FORWARDED_HOST"=>"server2.com",
"HTTP_X_FORWARDED_SERVER"=>"server2.com",
"rack.hijack"=>#<Puma::Client:0x3fc1c3969b68 @ready=true>,
"rack.session"=>#<ActionDispatch::Request::Session:0x007f83872d2a28 @by=#<ActionDispatch::Session::CookieStore:0x00000005b420a8 @app=#<Warden::Manager:0x00000005b42170 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure}, @app=#<CheckPermission:0x00000005b42198 @app=Sinatra::Application>>, @default_options={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}, @key="_pubshare_pubshare_staging_session", @cookie_only=true>, @env={...}, @delegate={}, @loaded=true, @exists=nil>,
"rack.session.options"=>#<ActionDispatch::Request::Session::Options:0x007f83872d29d8 @by=#<ActionDispatch::Session::CookieStore:0x00000005b420a8 @app=#<Warden::Manager:0x00000005b42170 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure}, @app=#<CheckPermission:0x00000005b42198 @app=Sinatra::Application>>, @default_options={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}, @key="_pubshare_pubshare_staging_session", @cookie_only=true>, @env={...}, @delegate={:path=>"/", :domain=>:all, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"612..."}>,
"warden"=>Warden::Proxy:70101442663600 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{}, :intercept_401=>true, :failure_app=>WardenFailure},
"rack.logger"=>#<Logger:0x007f83867d2970 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x007f83867d2948 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007f83867d28f8 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007f83867d28d0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007f83867d2880>>>>,
"rack.request.cookie_hash"=>{"_pubshare_pubshare_staging_session"=>"ZFd..."},
"rack.request.cookie_string"=>"_pubshare_pubshare_staging_session=ZFd...",
"action_dispatch.cookies"=>#<ActionDispatch::Cookies::CookieJar:0x007f83872d1c40 @key_generator=#<ActiveSupport::CachingKeyGenerator:0x00000004beeae8 @key_generator=#<ActiveSupport::KeyGenerator:0x00000004beebb0 @secret="ENV['SECRET_KEY_BASE']", @iterations=1000>, @cache_keys=#<ThreadSafe::Cache:0x00000004bee7a0 @backend={"signed_global_ids64"=>"\xF..."}, @default_proc=nil>>, @set_cookies={}, @delete_cookies={}, @host="server2.com", @secure=true, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @cookies={"_pubshare_pubshare_staging_session"=>"ZFd..."}, @committed=false, @encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007f83872d14c0 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007f83872d1c40 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007f83872d1358 @secret="e\x...", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007f83872d1290 @secret="\xCEGz\vNo\x87F\x9E\xD8\x1A>w:^?\xD4\x90\xD7/\xD9/,\x88i \x0F\x96&\xBEz\x06\xA9K\xB6\x8C5\xB6\e\x04\xCE\xE8l*\x87\xB0,3+\xBD72V\xE7\x15MW\xFBO\x9D'\xCB\xD2\xC1", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=ActiveSupport::MessageEncryptor::NullSerializer>>, @signed_or_encrypted=#<ActionDispatch::Cookies::EncryptedCookieJar:0x007f83872d14c0 @parent_jar=#<ActionDispatch::Cookies::CookieJar:0x007f83872d1c40 ...>, @options={:signed_cookie_salt=>"signed cookie", :encrypted_cookie_salt=>"encrypted cookie", :encrypted_signed_cookie_salt=>"signed encrypted cookie", :secret_token=>nil, :secret_key_base=>"ENV['SECRET_KEY_BASE']", :upgrade_legacy_signed_cookies=>false, :serializer=>:json, :digest=>nil}, @encryptor=#<ActiveSupport::MessageEncryptor:0x007f83872d1358 @secret="e\x...", @sign_secret="\xC...", @cipher="aes-256-cbc", @verifier=#<ActiveSupport::MessageVerifier:0x007f83872d1290 @secret="\xC...", @digest="SHA1", @serializer=ActiveSupport::MessageEncryptor::NullSerializer>, @serializer=ActiveSupport::MessageEncryptor::NullSerializer>>>,
"action_dispatch.request.unsigned_session_cookie"=>{"session_id"=>"b91f3dc2220bace810524ed4400f6150",
"warden.user.user.key"=>[[2],
"$2a$10$Y46GsGR.nGaWDWfFYnCA4e"],
"warden.user.user.session"=>{"last_request_at"=>1453684930},
"_csrf_token"=>"sY2HCre1HnZP05TEAsBZ4C8jHi9z2eIipXG2s4YYX2s="},
"rack.request.query_string"=>"",
"rack.request.query_hash"=>{},
"sinatra.route"=>"GET /:downloadable_id/:path/:dataset_id/:project_id/:sample_name/*.fastq.gz"}
最佳答案
我刚刚了解到 sinatra/rack-protection .将下面的行添加到我的 sinatra 应用程序解决了这个问题
set :protection, :except => :ip_spoofing
关于ruby-on-rails - Ruby Rack 中间件从反向代理丢失 warden session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34998877/
我正在编写一个 Sinatra Rack 应用程序,我想使用 Warden 进行身份验证。我正在使用 heroku 的工具带,所以我使用工头来运行我的应用程序。我找到了 some code这大概应该让
我正在玩 Mapr Sandbox,我不明白 Mapr Warden 应用程序的作用是什么。 Mapr 网站包含对配置文件的引用,但没有程序本身的描述。 最佳答案 Warden 是一个轻型 Java
每当我转到要求用户登录的路由时,我都会在服务器日志中收到一个 ArgumentError(未捕获的抛出:warden)。 Controller 代码如下: class TracksController
我有一个相当标准的Devise登录过程,其中: 看法: resource_name,:url => session_path(resource_name))做| f | %>
我正在尝试进行功能测试,需要使用 Warden 登录。 我已经做好了: class ActionController::TestCase include Warden::Test::Helpe
这是一个带有 before_filter 的非常典型的 Controller 的规范。当未登录用户(又名访客)尝试访问 /projects/new 时重定向到登录页面. describe Projec
我用 --api 设置了一个 Rails 5 (5.0.0.rc1) 应用程序旗帜。它使用 Warden 进行身份验证。 一切正常,除了当 Warden 身份验证失败时,响应没有被正确记录。日志如下所
我刚刚开始测试 Devise。我无法理解为什么我会收到此错误:: Failure/Error: subject.current_user.should_not be_nil ArgumentErro
我正在使用 Rails Warden插入。它定义了一个 helper method返回当前用户的“用户”。请参阅源代码链接。 现在我有一个没有任何 Controller 引用的业务逻辑对象。但我想获得
我有一个 Rails 应用程序,它使用 devise 来验证用户,然后在调用 sinatra 应用程序之前由中间件检查 session /管理员用户,我的 config.ru 在下面。 这在直接从服务
我按照本指南使用 Websockets 创建聊天功能。 https://www.sitepoint.com/rails-and-actioncable-adding-advanced-features
我在测试 Controller 和使用 Warden 时遇到问题。 所有示例都指向 stub request.env['warden']。当我调用 env['warden'] 时,这会导致我的 Con
当我测试我的规范之一时,我继续收到此问题: Failure/Error: visit "/" UncaughtThrowError: uncaught throw :warden 下面是代码的各个部分
假设我有两个默认的 Warden 策略,:database_authenticatable 和 :jwt。 我如何确定(在 Controller 内部)用于登录 current_user 的策略? 最
在从Devise切换到直接使用的过程中Warden . 我怎样才能实现 Devise 开箱即用的“忘记密码”功能? 是否有 gem 可以将此添加到 Warden 上? 附言。不使用 Devise 的原
当运行我的所有规范时,rspec 卡住并且在日志文件中存在以下内容: UncaughtThrowError - uncaught throw :warden: devise (3.5.1) lib
在查看别人的代码后,我注意到以下几点: login_as user, scope: :user 我一直都是简单地使用 login_as user 于是出去找解释,找到这篇文章How to: Test
我正在构建的站点要求用户一次只能通过一个 session 登录。如果用户在当前已登录的情况下尝试从其他浏览器或机器登录站点,则需要拒绝他们的登录尝试。 我考虑过将数据库中的用户对象标记为已登录,但这对
我创建了自己的 Warden 策略以与 Devise 一起使用。它与 Devise::Strategies::DatabaseAuthenticatable 非常相似,实际上它继承自它并重新实现身份验
我在 Rails 应用程序中使用 Devise 对用户进行身份验证。 我找到了两种方法,“warden.authenticate?”和“user.valid_password?”。 谁能告诉我它们之间
我是一名优秀的程序员,十分优秀!