Class: Aspera::WebAuth::Servlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Aspera::WebAuth::Servlet
- Includes:
- ServletHelpers
- Defined in:
- lib/aspera/web_auth/server.rb
Overview
servlet called on callback: it records the callback request
Instance Method Summary collapse
-
#initialize(server, web_auth) ⇒ Servlet
constructor
A new instance of Servlet.
-
#service(request, response) ⇒ Object
called on request.
Methods included from ServletHelpers
#authorization, #basic_authorized?, #check_request, host_name, #json_error, #json_response, origin, same_origin?
Constructor Details
Instance Method Details
#service(request, response) ⇒ Object
called on request
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/aspera/web_auth/server.rb', line 39 def service(request, response) Log.log.debug { "received request from browser #{request.request_method} #{request.path}" } # Refuse requests of other web pages check_request(request) Aspera.assert_values(request.request_method, ['GET'], type: WEBrick::HTTPStatus::MethodNotAllowed) { "Unsupported method: #{request.request_method}" } Aspera.assert_values(request.path, [@web_auth.expected_path], type: WEBrick::HTTPStatus::NotFound) { "Unsupported path: #{request.path}" } # response to browser response.status = 200 if @web_auth.reply_keys.nil? WebPage.secure_headers(response) response.body = WebPage.render(HTML_TEMPLATE_PATH, title: 'Authentication Complete', additional_info: @web_auth.additional_info) else render_reply(request, response) end # continue internal processing @web_auth.signal_request(request) nil end |