Class: Aspera::WebAuth
- Inherits:
-
WebServerSimple
- Object
- WEBrick::HTTPServer
- WebServerSimple
- Aspera::WebAuth
- Defined in:
- lib/aspera/web_auth.rb
Overview
start a local web server, then start a browser that will callback the local server upon authentication
Instance Attribute Summary collapse
-
#cond ⇒ Object
readonly
Returns the value of attribute cond.
-
#expected_path ⇒ Object
readonly
Returns the value of attribute expected_path.
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
-
#query ⇒ Object
writeonly
Sets the attribute query.
Instance Method Summary collapse
-
#initialize(endpoint_url) ⇒ WebAuth
constructor
A new instance of WebAuth.
-
#received_request ⇒ Object
wait for request on web server.
Methods inherited from WebServerSimple
#<<, fill_self_signed_cert, #start
Constructor Details
#initialize(endpoint_url) ⇒ WebAuth
Returns a new instance of WebAuth.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/aspera/web_auth.rb', line 38 def initialize(endpoint_url) uri = URI.parse(endpoint_url) super(uri) # parameters for servlet @mutex = Mutex.new @cond = ConditionVariable.new @expected_path = uri.path.empty? ? '/' : uri.path @query = nil # last argument (self) is provided to constructor of servlet mount(@expected_path, WebAuthServlet, self) Thread.new { start } end |
Instance Attribute Details
#cond ⇒ Object (readonly)
Returns the value of attribute cond.
34 35 36 |
# File 'lib/aspera/web_auth.rb', line 34 def cond @cond end |
#expected_path ⇒ Object (readonly)
Returns the value of attribute expected_path.
34 35 36 |
# File 'lib/aspera/web_auth.rb', line 34 def expected_path @expected_path end |
#mutex ⇒ Object (readonly)
Returns the value of attribute mutex.
34 35 36 |
# File 'lib/aspera/web_auth.rb', line 34 def mutex @mutex end |
#query=(value) ⇒ Object (writeonly)
Sets the attribute query
35 36 37 |
# File 'lib/aspera/web_auth.rb', line 35 def query=(value) @query = value end |
Instance Method Details
#received_request ⇒ Object
wait for request on web server
53 54 55 56 57 58 59 |
# File 'lib/aspera/web_auth.rb', line 53 def received_request # wait for signal from thread @mutex.synchronize{@cond.wait(@mutex)} # tell server thread to stop shutdown return @query end |