Module: RBus::Auth

Defined in:
lib/rbus/auth/auth.rb,
lib/rbus/auth/dummy.rb,
lib/rbus/auth/external.rb,
lib/rbus/auth/state_machine.rb,
lib/rbus/auth/dbus_cookie_sha1.rb

Defined Under Namespace

Classes: Command, DBusCookieSHA1, Dummy, External, StateMachine

Constant Summary collapse

MECHANISMS =
{
  'EXTERNAL' => External,
  'DBUS_COOKIE_SHA1' => DBusCookieSHA1
}
FIRST_MECHANISM =
Dummy

Class Method Summary collapse

Class Method Details

.authorize(transport) ⇒ Object

Authorize with the bus via its Transport object.

Raises:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rbus/auth/auth.rb', line 36

def self.authorize(transport)  
  raise AuthException, 'transport is nil' if transport.nil?
  
  # Init Auth process
  transport.send("\0")
  
  # use a statemachine as the spec suggests
  state_machine = StateMachine.new(transport)
  begin
    # return server guid on success - not used today though.
    return state_machine.authorize
  rescue AuthException
    transport.close
    raise
  end
end