pallets-eco / flask-jwt

JWT (JSON Web Tokens) for Flask applications
MIT License
564 stars 178 forks source link

Handle Payload from ws federation response #135

Open vinothkumar1097 opened 5 years ago

vinothkumar1097 commented 5 years ago

Hi,

I have a flask app which is integrated with our company idp which runs successfully. Now i'm struggling to extract user details from saml response after successull login. In Response, im getting user details like name, mail-id. Could you guys direct me how to handle this.

Below is the response after login: %3CRequestSecurityTokenResponseCollection+xmlns%3D%22http%3A%2F%2Fdocs.oasis-open.org%2Fws-sx%2Fws-trust%2F200512%22+xmlns%3Ans2%3D%22http%3A%2F%2Fdocs.oasis-open.org%2Fwss%2F2004%2F01%2Foasis-200401-wss-wssecurity-utility-1.0.xsd%22+xmlns%3Ans3%3D%22http%3A%2F%2Fdocs.oasis-open.org%2Fwss%2F2004%2F01%2Foasis-200401-wss-wssecurity-secext-1.0.xsd%22+xmlns%3Ans4%3D%22http%3A%2F%2Fwww.w3.org%2F2005%2F08%2Faddressing%22+xmlns%3Ans5%3D%22http%3A%2F%2Fdocs.oasis-open.org%2Fws-sx%2Fws-trust%2F200802%22%3E%3CRequestSecurityTokenResponse%3E%3CTokenType%3Ehttp%3A%2F%2Fdocs.oasis-open.org%2Fwss%2Foasis-wss-saml-token-profile-1.1%23SAMLV1.1%3C%2FTokenType%3E%3CRequestedSecurityToken%3E%3Csaml1%3AAssertion+xmlns%3Asaml1%3D%22urn%3Aoasis%3Anames%3Atc%3ASAML%3A1.0%3Aassertion%22+xmlns%3Axs%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+AssertionID%3D%22_CE38CAAF23319076E415690808929633680%22+IssueInstant%3D%222019-09-21T15%3A48%3A12.963Z%22+Issuer%3D%22STS+Realm+A%22+MajorVersion%3D%221%22+MinorVersion%3D%221%22+xsi%3Atype%3D%22saml1%3AAssertionType%22%3E%3Csaml1%3AConditions+NotBefore%3D%222019-09-21T15%3A48%3A12.932Z%22+NotOnOrAfter%3D%222019-09-22T03%3A48%3A12.932Z%22%3E%3Csaml1%3AAudienceRestrictionCondition%3E%3Csaml1%3AAudience%3Eurn%3Asource.company.net%3Asharepoint%3C%2Fsaml1%3AAudience%3E%3C%2Fsaml1%3AAudienceRestrictionCondition%3E%3C%2Fsaml1%3AConditions%3E%3Csaml1%3AAttributeStatement%3E%3Csaml1%3ASubject%3E%3Csaml1%3ANameIdentifier+Format%3D%22urn%3Aoasis%3Anames%3Atc%3ASAML%3A1.1%3Anameid-format%3Aunspecified%22+NameQualifier%3D%22http%3A%2F%2Fcxf.apache.org%2Fsts%22%3EA697643%3C%2Fsaml1%3ANameIdentifier%3E%3Csaml1%3ASubjectConfirmation%3E%3Csaml1%3AConfirmationMethod%3Eurn%3Aoasis%3Anames%3Atc%3ASAML%3A1.0%3Acm%3Abearer%3C%2Fsaml1%3AConfirmationMethod%3E%3C%2Fsaml1%3ASubjectConfirmation%3E%3C%2Fsaml1%3ASubject%3E%3Csaml1%3AAttribute+AttributeName%3D%22givenname%22+AttributeNamespace%3D%22http%3A%2F%2Fschemas.xmlsoap.org%2Fws%2F2005%2F05%2Fidentity%2Fclaims%22%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EL+Kishore%3C%2Fsaml1%3AAttributeValue%3E%3C%2Fsaml1%3AAttribute%3E%3Csaml1%3AAttribute+AttributeName%3D%22surname%22+AttributeNamespace%3D%22http%3A%2F%2Fschemas.xmlsoap.org%2Fws%2F2005%2F05%2Fidentity%2Fclaims%22%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EKumar%3C%2Fsaml1%3AAttributeValue%3E%3C%2Fsaml1%3AAttribute%3E%3Csaml1%3AAttribute+AttributeName%3D%22emailaddress%22+AttributeNamespace%3D%22http%3A%2F%2Fschemas.xmlsoap.org%2Fws%2F2005%2F05%2Fidentity%2Fclaims%22%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3El-kishore.kumar%40comp.net%3C%2Fsaml1%3AAttributeValue%3E%3C%2Fsaml1%3AAttribute%3E%3Csaml1%3AAttribute+AttributeName%3D%22windowsaccountname%22+AttributeNamespace%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fws%2F2008%2F06%2Fidentity%2Fclaims%22%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EA697643%3C%2Fsaml1%3AAttributeValue%3E%3C%2Fsaml1%3AAttribute%3E%3Csaml1%3AAttribute+AttributeName%3D%22role%22+AttributeNamespace%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fws%2F2008%2F06%2Fidentity%2Fclaims%22%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EWW--Company%3C%2Fsaml1%3AAttributeValue%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EGGagcfg00001k72%3C%2Fsaml1%3AAttributeValue%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EGGagcfg00001f0c%3C%2Fsaml1%3AAttributeValue%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EGGagcfg00001da0%3C%2Fsaml1%3AAttributeValue%3E%3Csaml1%3AAttributeValue+xsi%3Atype%3D%22xs%3Astring%22%3EWW-%3ASignatureValue%3Ee270RngBPzo66CqTt2B6%2BlD7udmBHP43%2BU7ueuvMIg24O6z8Sv3OJxFIEqHWmxo9%2FlD3WI9coNRmReJiq3s8ySrmiAp0YMi5AYb9dWLX3rmPTUt4VNk4tSA3qdxvESvyYtXxExY3Oj08txFUiw3d8Ljz8eMdW7azm%2BQdnGf0..........................

Let me know if need any additional info.