Class: Aspera::WebAuthServlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Aspera::WebAuthServlet
- Defined in:
- lib/aspera/web_auth.rb
Overview
servlet called on callback: it records the callback request
Instance Method Summary collapse
-
#initialize(server, web_auth) ⇒ WebAuthServlet
constructor
A new instance of WebAuthServlet.
- #service(request, response) ⇒ Object
Constructor Details
#initialize(server, web_auth) ⇒ WebAuthServlet
Returns a new instance of WebAuthServlet.
10 11 12 13 14 |
# File 'lib/aspera/web_auth.rb', line 10 def initialize(server, web_auth) Log.log.debug('WebAuthServlet initialize') super(server) @web_auth = web_auth end |
Instance Method Details
#service(request, response) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/aspera/web_auth.rb', line 16 def service(request, response) Log.log.debug{"received request from browser #{request.request_method} #{request.path}"} raise WEBrick::HTTPStatus::MethodNotAllowed, "unexpected method: #{request.request_method}" unless request.request_method.eql?('GET') raise WEBrick::HTTPStatus::NotFound, "unexpected path: #{request.path}" unless request.path.eql?(@web_auth.expected_path) # acquire lock and signal change @web_auth.mutex.synchronize do @web_auth.query = request.query @web_auth.cond.signal end response.status = 200 response.content_type = 'text/html' response.body = '<html><head><title>Ok</title></head><body><h1>Thank you !</h1><p>You can close this window.</p></body></html>' return nil end |