onelogin/ruby-saml — pull request #135 by borgand (2014-06-06 11:49:12+00:00)
Title: Restored support for NIL as well as empty AttributeValues

@sebastienluquet commented on onelogin/ruby-saml@3e7a9a9:

> I have an issue with this patch. attributes method does not parse this xml any more:
>
>
>
>
> I expect attributes including
>
> { "ATTRIBUTE_NAME" => nil }

What I read from SAMLCore:

> 1. if the SAML attribute exists but has no values, then the `` element MUST be omitted

> 2. If a SAML attribute includes an empty value, such as the empty string, the corresponding `` element MUST be empty (generally this is serialized as ``).

> 3. if a SAML attribute includes a `"null"` value, the corresponding `` element MUST be empty and MUST contain the reserved `xsi:nil` XML attribute with a value of `"true"` or `"1"`.

This pull request restores parsing empty `` into `nil` or `""` as per specs. Note that (2) above does not define empty string, but currently `ruby-saml` does not support `xsi:type` and regards all values as strings, thus empty value essentially means empty string in `ruby-saml` current implementation.

**NB!** this does not fully resolve @sebastienluquet's issue, if his XML does not contain the `xsi:nil` attribute, but it would be against specs to parse that into `nil`.