Class: CockpitController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/cockpit_controller.rb

Instance Method Summary collapse

Instance Method Details

#host_ssh_paramsObject



4
5
6
# File 'app/controllers/cockpit_controller.rb', line 4

def host_ssh_params
  render :json => SSHExecutionProvider.ssh_params(@host)
end

#redirectObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/cockpit_controller.rb', line 8

def redirect
  return invalid_request unless params[:redirect_uri]

  redir_url = URI.parse(params[:redirect_uri])

  cockpit_url = SSHExecutionProvider.cockpit_url_for_host('')
  redir_url.query = if redir_url.hostname == URI.join(Setting[:foreman_url], cockpit_url).hostname
                      "access_token=#{request.session_options[:id]}"
                    else
                      "error_description=Sorry"
                    end
  redirect_to(redir_url.to_s)
end