def valid_credentials!(kind, username, *credentials)
      if kind == :user
        credentials = [username, *credentials]
      end
      all_credentials(kind) << { :username => username, :credentials =>  credentials }
      @users[username] ||= Aker::User.new(username)

      yield UserBuilder.new(@users[username], self) if block_given?
    end
def valid_credentials!(kind, username, *credentials)
      if kind == :user
        credentials = [username, *credentials]
      end
      all_credentials(kind) << { :username => username, :credentials =>  credentials }
      @users[username] ||= Aker::User.new(username)

      yield UserBuilder.new(@users[username], self) if block_given?
    end
Associate the given set of credentials of a particular kind with
 the specified user.  Note that all kinds require a username
 (unlike with {#valid_credentials?}).  Examples:

     auth.valid_credentials!(:user, "wakibbe", "ekibder")
     auth.valid_credentials!(:api_key, "notis-app", "12345-67890")

 For further user customization, you can pass a block.  This block
 receives an object that responds to all {Aker::User} methods as well as
 helper methods for setting up portal and group memberships.
 Examples:

     auth.valid_credentials!(:user, "wakibbe", "ekibder") do |u|
       # grants access to portal :ENU
       u.in_portal!(:ENU)

       # sets up name data
       u.first_name = 'Warren'
       u.last_name = 'Kibbe'
     end

     auth.valid_credentials!(:user, "wakibbe", "ekibder") do |u|
       # grants access to portal :ENU and membership in group "User"
       u.in_group!(:ENU, "User")
     end

     auth.valid_credentials!(:api_key, "notis-ns", "12345-67890") do |u|
       # grants access to portal :NOTIS and membership in group "Auditor"
       for affiliates 20 and 30
       u.in_group!(:NOTIS, "Auditor", :affiliate_ids => [20, 30])
     end

 @param [Symbol] kind the kind of credentials these are.
   Anything is allowed.
 @param [String] username the username for the user which is
   authenticated by these credentials.
 @param [Array<String>,nil] *credentials the credentials
   themselves.  (Note that you need not repeat the username for
   the :user kind.)
 @yield [user] a user object as described above

 @return [void]