Class: Plasma::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/plasma/auth.rb

Overview

Handles authentication operations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Auth

Returns a new instance of Auth.



10
11
12
# File 'lib/plasma/auth.rb', line 10

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/plasma/auth.rb', line 8

def options
  @options
end

Instance Method Details

#startObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/plasma/auth.rb', line 14

def start
  puts "Starting authentication server..."

  return error_not_plasma_project unless plasma_project?

  application = Plasma::Loader.load_project
  config = application.config

  port, host = resolve_port_and_host(config)
  auth_server_class = resolve_auth_server_class(application)
  puma_auth_server = Puma::Server.new(auth_server_class.new)
  puma_auth_server.add_tcp_listener(host, port)

  run_and_wait_for_shutdown(puma_auth_server, auth_server_class)

  # TODO: check if the config vars have actually been set
  puts "Authentication server succesfully shutdown."
end