Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize NameID object before writting it in the session object. #8

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

pdelboca
Copy link
Member

@pdelboca pdelboca commented Jan 15, 2025

This PR fixes an issue that occurs because NameID is not a serializable object and therefore we cannot assign it to the session object.

The name_id is not JSON serializable
'name_id': <saml2.saml.NameID object at 0x7fca2256f090>

SecureCookieSession object:

        {
            '_user_id': 'ca876e56-xxx',
            '_fresh': True,
            '_id': '892f7fec2xxxx',
            '_saml_session_info': {
                'ava': {
                    'uid': ['test'], 'email': ['[email protected]'], 'firstname': ['John'],
                    'lastname': ['Smith'], 'fullname': ['John Smith (Operations)'],
                    'eduPersonAffiliation': ['users', 'examplerole1']
                },

               'name_id': <saml2.saml.NameID object at 0x7fca2256f090>,

                'came_from': None,
                'issuer': 'http://idp.example.com/metadata.php',
                'not_on_or_after': 1926493308,
                'authn_info': [
                    ('urn:oasis:names:tc:SAML:2.0:ac:classes:Password', [], '2025-01-14T20:06:00.934671')
                ],
                'session_index': '_be9967abd904ddcae3c0eb4189adbe3f71e327cf93'
            },
            '_saml2_subject_id': '1=urn%3Agov%3Agsa%3ASAML%3A2.0.profiles%3Asp%3Asso%3Atest%3Aentity,2=urn%3Aoasis%3Anames%3Atc%3ASAML%3A2.0%3Anameid-format%3Atransient,4=_ce3d29xxx'
        }

@avdata99
Copy link
Member

I'll merge to test loclly with my changes

@avdata99 avdata99 merged commit f5e0cfd into main Jan 15, 2025
1 of 4 checks passed
@avdata99 avdata99 mentioned this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants