Class: Apiphobic::Middleware::Validators::Subdomain
- Inherits:
-
Object
- Object
- Apiphobic::Middleware::Validators::Subdomain
- Includes:
- Configurable
- Defined in:
- lib/apiphobic/middleware/validators/subdomain.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Subdomain
constructor
A new instance of Subdomain.
Methods included from Configurable
Constructor Details
#initialize(app) ⇒ Subdomain
Returns a new instance of Subdomain.
13 14 15 |
# File 'lib/apiphobic/middleware/validators/subdomain.rb', line 13 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/apiphobic/middleware/validators/subdomain.rb', line 17 def call(env) request = Requests::Subdomain.new(env) subdomain = Matchers::Subdomain.new( allowed_subdomains: configuration.allowed_subdomains, ) return Responses::InvalidSubdomain.call(env) unless subdomain.matches?(request) @app.call(env) end |