class EventMachine::Ssh::AuthenticationSession

Public Instance Methods

authenticate(*args) click to toggle source
Calls superclass method
# File lib/em-ssh/authentication-session.rb, line 6
def authenticate(*args)
  debug { "authenticate(#{args.join(", ")})" }
  super(*args)
end
next_message() click to toggle source

Returns once an acceptable auth packet is received.

# File lib/em-ssh/authentication-session.rb, line 12
def next_message
  packet = transport.next_message

  case packet.type
  when USERAUTH_BANNER
    info { packet[:message] }
    transport.fire(:auth_banner, packet[:message])
    return next_message
  when USERAUTH_FAILURE
    @allowed_auth_methods = packet[:authentications].split(/,/)
    debug { "allowed methods: #{packet[:authentications]}" }
    return packet

  when USERAUTH_METHOD_RANGE, SERVICE_ACCEPT
    return packet

  when USERAUTH_SUCCESS
    transport.hint :authenticated
    return packet

  else
    raise SshError, "unexpected message #{packet.type} (#{packet})"
  end
end