class Net::SSH::Authentication::Methods::None

  1. lib/net/ssh/authentication/methods/none.rb
Parent: Methods

Implements the "none" SSH authentication method.

Methods

Public Instance

  1. authenticate

Public Instance methods

authenticate (next_service, user="", password="")

Attempt to authenticate as "none"

[show source]
# File lib/net/ssh/authentication/methods/none.rb, line 12
def authenticate(next_service, user="", password="")
  send_message(userauth_request(user, next_service, "none")) 
  message = session.next_message
  
  case message.type
    when USERAUTH_SUCCESS
      debug { "none succeeded" }
      return true
    when USERAUTH_FAILURE
      debug { "none failed" }
    
      raise Net::SSH::Authentication::DisallowedMethod unless
        message[:authentications].split(/,/).include? 'none'
    
      return false
    else
      raise Net::SSH::Exception, "unexpected reply to USERAUTH_REQUEST: #{message.type} (#{message.inspect})"
  end   
  
end