Class: Securial::Middleware::ResponseHeaders
- Inherits:
-
Object
- Object
- Securial::Middleware::ResponseHeaders
- Defined in:
- lib/securial/middleware/response_headers.rb
Overview
Rack middleware that adds Securial identification headers to responses.
This middleware enhances security transparency by clearly identifying when Securial is mounted in an application and provides developer attribution information in response headers.
Instance Method Summary collapse
-
#call(env) ⇒ Array
Processes the request and adds Securial headers to the response.
-
#initialize(app) ⇒ ResponseHeaders
constructor
Initializes the middleware with the Rack application.
Constructor Details
#initialize(app) ⇒ ResponseHeaders
Initializes the middleware with the Rack application.
35 36 37 |
# File 'lib/securial/middleware/response_headers.rb', line 35 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Array
Processes the request and adds Securial headers to the response.
Calls the wrapped application and then adds identification headers to the response before returning it to the client. The headers provide clear indication of Securial usage and developer attribution.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/securial/middleware/response_headers.rb', line 54 def call(env) status, headers, response = @app.call(env) # Indicate that Securial is mounted and active headers["X-Securial-Mounted"] = "true" # Provide developer attribution headers["X-Securial-Developer"] = "Aly Badawy - https://alybadawy.com | @alybadawy" [status, headers, response] end |