Class: DBus::Authentication::Client Private
- Inherits:
-
Object
- Object
- DBus::Authentication::Client
- Defined in:
- lib/dbus/auth.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Authenticates the connection before messages can be exchanged.
Instance Attribute Summary collapse
- #address_uuid ⇒ String readonly private
-
#unix_fd ⇒ Boolean
readonly
private
NOTE: not implemented yet in upper layers.
Instance Method Summary collapse
-
#authenticate ⇒ void
private
Start the authentication process.
-
#initialize(socket, mechs = nil) ⇒ Client
constructor
private
Create a new authentication client.
Constructor Details
#initialize(socket, mechs = nil) ⇒ Client
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new authentication client.
133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/dbus/auth.rb', line 133 def initialize(socket, mechs = nil) @unix_fd = false @address_uuid = nil @socket = socket @state = nil @auth_list = mechs || [ External, DBusCookieSHA1, ExternalWithoutUid, Anonymous ] end |
Instance Attribute Details
#address_uuid ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
129 130 131 |
# File 'lib/dbus/auth.rb', line 129 def address_uuid @address_uuid end |
#unix_fd ⇒ Boolean (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
NOTE: not implemented yet in upper layers
126 127 128 |
# File 'lib/dbus/auth.rb', line 126 def unix_fd @unix_fd end |
Instance Method Details
#authenticate ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Start the authentication process.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/dbus/auth.rb', line 150 def authenticate DBus.logger.debug "Authenticating" send_nul_byte use_next_mechanism @state, command = next_state_via_mechanism.to_a send(command) loop do DBus.logger.debug "auth STATE: #{@state}" words = next_msg @state, command = next_state(words).to_a break if [:TerminatedOk, :TerminatedError].include? @state send(command) end raise AuthenticationFailed, command.first if @state == :TerminatedError send("BEGIN") end |