Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Extra attributes with multiple values are lost in transit #5

Open
dayer4b opened this issue May 28, 2014 · 3 comments
Open

Extra attributes with multiple values are lost in transit #5

dayer4b opened this issue May 28, 2014 · 3 comments

Comments

@dayer4b
Copy link
Contributor

dayer4b commented May 28, 2014

When a user authenticates and user data, along with extra attributes, are loaded (especially with the Net::LDAP#search fix - see pull request #4 ), the user data that is returned may be missing some values.

I have seen this with the data from the OpenLDAP memberof overlay, which creates multiple entries named 'memberof' for each group to which the user belongs.

I recommend the following change:

  def extra_attributes
    if @options[:extra_attributes]
      result = {}
      @options[:extra_attributes].each do |index_result, index_ldap|
        value = @user_plain[index_ldap]
        if value
          result[index_result] = "#{value.join(', ')}"
        end
      end
      result
    else
      nil
    end
  end

This will keep the attribute values in string form and also permit multiple values.

I'll submit a Pull Request with this soon.

@pencil
Copy link
Member

pencil commented Jul 23, 2015

From #6:

CASino 4.0 supports multiple-values for a single field. Basically we can change this line to:

result[index_result] = value

I currently don't have the infrastructure to test it but if you are still interested, you might want to give it a try.

@twyfordr
Copy link

Would commas be a safe delimiter here? For at least the Active Directory implementation of LDAP, memberof returns a list of DNs, each of which is a comma-delimited list of RDNs.

@dballenger
Copy link

I monkey patched to set result[index_result] = value and it works (so I can get all the memberOf entries).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants