Module: Aspera::WebAuth
- Defined in:
- lib/aspera/web_auth/paste.rb,
lib/aspera/web_auth/relay.rb,
lib/aspera/web_auth/server.rb,
lib/aspera/web_auth/receiver.rb
Defined Under Namespace
Modules: Relay Classes: Paste, Server, Servlet
Class Method Summary collapse
-
.open_login_page(login_receiver, login_url) ⇒ Object
Let the user open the login page, unless the receiver already gives the URL in its own message.
-
.receiver(redirect_uri, additional_info = nil, login_url: nil, reply_keys: nil) ⇒ Server, Paste
Create the object that receives the result of a web login, according to
Environment#web_auth(optionui.web_auth)::portlistens on the loopback address ofredirect_uri,:pasteasks the user to give the result in the terminal.
Class Method Details
.open_login_page(login_receiver, login_url) ⇒ Object
Let the user open the login page, unless the receiver already gives the URL in its own message
44 45 46 47 |
# File 'lib/aspera/web_auth/receiver.rb', line 44 def open_login_page(login_receiver, login_url) return if login_receiver.is_a?(Paste) && login_receiver.shows_login_url? Environment.instance.open_uri(login_url) end |
.receiver(redirect_uri, additional_info = nil, login_url: nil, reply_keys: nil) ⇒ Server, Paste
Create the object that receives the result of a web login, according to Environment#web_auth (option ui.web_auth):
:port listens on the loopback address of redirect_uri, :paste asks the user to give the result in the terminal.
Both provide received_request.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/aspera/web_auth/receiver.rb', line 23 def receiver(redirect_uri, additional_info = nil, login_url: nil, reply_keys: nil) env = Environment.instance case env.web_auth when :paste login_url = nil if env.browser_command || env.url_method.eql?(:graphical) Paste.new(redirect_uri, login_url: login_url, reply_keys: reply_keys) when :port if env.url_method.eql?(:text) && env.browser_command.nil? && (ENV.key?('SSH_CONNECTION') || ENV.key?('SSH_TTY')) Log.log.warn do "Web login: the browser must reach port #{URI.parse(redirect_uri).port} of this host (SSH tunnel). " \ 'If not possible, use option --ui.web_auth=paste' end end Server.new(redirect_uri, additional_info) else Aspera.error_unexpected_value(env.web_auth) { 'ui.web_auth' } end end |