Method: ChefAPI::Resource::User.authenticate

Defined in:
lib/chef-api/resources/user.rb

.authenticate(options = {}) ⇒ Hash

Note:

Requires Enterprise Chef

Authenticate a user with the given username and password.

Examples:

Authenticate a user

User.authenticate(username: 'user', password: 'pass')
  #=> { "status" => "linked", "user" => { ... } }

Parameters:

  • options (Hash) (defaults to: {})

    the list of options to authenticate with

Options Hash (options):

  • username (String)

    the username to authenticate with

  • password (String)

    the plain-text password to authenticate with

Returns:

  • (Hash)

    the parsed JSON response from the server



77
78
79
# File 'lib/chef-api/resources/user.rb', line 77

def authenticate(options = {})
  connection.post('/authenticate_user', options.to_json)
end