Skip to content

Commit

Permalink
Separate multiple attribute values with the same name instead of conc…
Browse files Browse the repository at this point in the history
…atenating them (#67)
  • Loading branch information
fumieval committed Aug 5, 2024
1 parent 12003d4 commit db3829c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 0.7

- Replaced `x509Certificate` with `x509Certificates` in `IDPSSODescriptor` so that it may have more than one certificate ([#65](https://github.com/mbg/wai-saml2/pull/65) by [@fumieval](https://github.com/fumieval))
- Added `attributeValues` to `AssertionAttribute` in order to handle multiple attribute values with the same name ([#67](https://github.com/mbg/wai-saml2/pull/67) by [@fumieval](https://github.com/fumieval))

## 0.6

Expand Down
13 changes: 9 additions & 4 deletions src/Network/Wai/SAML2/Assertion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,24 @@ data AssertionAttribute = AssertionAttribute {
attributeFriendlyName :: !(Maybe T.Text),
-- | The name format.
attributeNameFormat :: !T.Text,
-- | The value of the attribute.
attributeValue :: !T.Text
-- | The value of the attribute, concatened from the 'attributeValues'.
attributeValue :: !T.Text,
-- | The values of the attribute.
--
-- @since 0.7
attributeValues :: ![T.Text]
} deriving (Eq, Show)

instance FromXML AssertionAttribute where
parseXML cursor = do
let attributeValues = cursor $/ element (saml2Name "AttributeValue") &/ content
pure AssertionAttribute{
attributeName = T.concat $ attribute "Name" cursor,
attributeFriendlyName =
toMaybeText $ attribute "FriendlyName" cursor,
attributeNameFormat = T.concat $ attribute "NameFormat" cursor,
attributeValue = T.concat $
cursor $/ element (saml2Name "AttributeValue") &/ content
attributeValue = T.concat attributeValues,
attributeValues = attributeValues
}

-- | SAML2 assertion statements (collections of assertion attributes).
Expand Down

0 comments on commit db3829c

Please sign in to comment.