Class: WebConsole::Request
- Inherits:
-
ActionDispatch::Request
- Object
- ActionDispatch::Request
- WebConsole::Request
- Defined in:
- lib/web_console/request.rb
Overview
Web Console tailored request object.
Defined Under Namespace
Classes: GetSecureIp
Constant Summary collapse
Instance Method Summary collapse
-
#acceptable? ⇒ Boolean
Returns whether the request is acceptable.
-
#from_whitelisted_ip? ⇒ Boolean
Returns whether a request came from a whitelisted IP.
-
#strict_remote_ip ⇒ Object
Determines the remote IP using our much stricter whitelist.
Instance Method Details
#acceptable? ⇒ Boolean
Returns whether the request is acceptable.
29 30 31 |
# File 'lib/web_console/request.rb', line 29 def acceptable? xhr? && accepts.any? { |mime| Mime[:web_console_v2] == mime } end |
#from_whitelisted_ip? ⇒ Boolean
Returns whether a request came from a whitelisted IP.
For a request to hit Web Console features, it needs to come from a white listed IP.
17 18 19 |
# File 'lib/web_console/request.rb', line 17 def from_whitelisted_ip? whitelisted_ips.include?(strict_remote_ip) end |
#strict_remote_ip ⇒ Object
Determines the remote IP using our much stricter whitelist.
22 23 24 25 26 |
# File 'lib/web_console/request.rb', line 22 def strict_remote_ip GetSecureIp.new(self, whitelisted_ips).to_s rescue ActionDispatch::RemoteIp::IpSpoofAttackError "[Spoofed]" end |