IdentityPython / djangosaml2

Django SAML2 Service Provider based on pySAML2
Apache License 2.0
254 stars 143 forks source link

[Question] How to parse to attribute in SAMLResponse at django view? #367

Open pakyeongjo opened 1 year ago

pakyeongjo commented 1 year ago

Hello. First of all, I apologize if the issue is inappropriate. I couldn't find the appropriate format to ask the question.

After the SSO request is successful, I want to get the attributes of the user who authenticated on the screen after the redirect was performed from AssertionConsumerServiceView to 'relay_state'. In the post method in AssertionConsumerServiceView, 'assertion_info' seems to be the data I'm looking for, but I couldn't find a way to get that information at the time of redirect.

I've been thinking about how to override post_login_hook or customize_session, but I haven't found the right solution. Assertion_info is used only for authentication and does not appear to be managed anymore.

How do I check the SP for the user's credentials provided by the IDP?

https://github.com/IdentityPython/djangosaml2/blob/master/djangosaml2/views.py#L408

peppelinux commented 1 year ago

Just configure the login redirect url to this view https://github.com/IdentityPython/djangosaml2/blob/master/djangosaml2/views.py#L617