Skip to content

Commit 397cfc8

Browse files
author
Alexander Schrijver
committed
Add the ability to decrypt EncryptedIDs from AttributeStatements.
1 parent 615bb73 commit 397cfc8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/onelogin/saml2/response.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,19 @@ def get_attributes(self):
591591
if attr_text:
592592
values.append(attr_text)
593593

594+
# Parse encrypted ids
595+
for encrypted_id in attr.iterchildren('{%s}EncryptedID' % OneLogin_Saml2_Constants.NSMAP['saml']):
596+
key = self.__settings.get_sp_key()
597+
encrypted_data = encrypted_id.getchildren()[0]
598+
nameid = OneLogin_Saml2_Utils.decrypt_element(encrypted_data, key)
599+
values.append({
600+
'NameID': {
601+
'Format': nameid.get('Format'),
602+
'NameQualifier': nameid.get('NameQualifier'),
603+
'value': nameid.text
604+
}
605+
})
606+
594607
# Parse any nested NameID children
595608
for nameid in attr.iterchildren('{%s}NameID' % OneLogin_Saml2_Constants.NSMAP['saml']):
596609
values.append({

0 commit comments

Comments
 (0)