{"id":22800938,"url":"https://github.com/ximaz/saml-idp","last_synced_at":"2025-03-30T19:26:59.057Z","repository":{"id":213015823,"uuid":"731487111","full_name":"Ximaz/saml-idp","owner":"Ximaz","description":"A Python library to handle SAML Identity Provider side.","archived":false,"fork":false,"pushed_at":"2023-12-17T23:28:28.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T22:20:01.449Z","etag":null,"topics":["saml","saml-assertion","saml-authentication","saml-idp","saml-metadata","saml2"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ximaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-14T07:37:17.000Z","updated_at":"2023-12-17T23:15:36.000Z","dependencies_parsed_at":"2023-12-18T01:00:17.438Z","dependency_job_id":null,"html_url":"https://github.com/Ximaz/saml-idp","commit_stats":null,"previous_names":["ximaz/saml-idp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ximaz%2Fsaml-idp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ximaz%2Fsaml-idp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ximaz%2Fsaml-idp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ximaz%2Fsaml-idp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ximaz","download_url":"https://codeload.github.com/Ximaz/saml-idp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246367816,"owners_count":20765934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["saml","saml-assertion","saml-authentication","saml-idp","saml-metadata","saml2"],"created_at":"2024-12-12T08:08:28.573Z","updated_at":"2025-03-30T19:26:59.022Z","avatar_url":"https://github.com/Ximaz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SAML IdP\n\nPython library to handle SAML requests and to respond with actual SAML responses.\n\n# Example\n\nPython code which handles an SAML Request sent by a Service Provider :\n\n```python\nimport saml_handler\n\nSAMLRequest = saml_handler.SAMLRequest(saml_request=\"\u003cSAML_Request_from_Service_Provider\u003e\")\n\n# User authentication \u003c...\u003e\nuser = { ... }\n\nSAMLResponse = saml_handler.SAMLResponse(saml_request=SAMLRequest, name_id=user[\"username\"])\nSAMLResponse.set_field(\"email\", user[\"email\"])\nSAMLResponse.set_field(\"firstname\", user[\"firstname\"])\nSAMLResponse.set_field(\"lastname\", user[\"lastname\"])\nSAMLResponse.set_field(\"uid\", user[\"username\"])\n\nsigned_assertion = SAMLResponse.sign(\"certs/private.key\", \"certs/public.crt\")\n\n# Send assertion to the service provider \u003c...\u003e\n```\n\nThe XML SAML Response produced by the `saml_handler` :\n\n```xml\n\u003csamlp:Response xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"\n    ID=\"[IDENTITY_PROVIDER_RESPONSE_ID]\" Version=\"2.0\" IssueInstant=\"2023-12-17T22:53:41Z\"\n    Destination=\"[SERVICE_PROVIDER_ACS]\" InResponseTo=\"[SERVICE_PROVIDER_REQUEST_ID]\"\u003e\n    \u003csaml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"\u003e\n        [IDENTITY_PROVIDER]\n    \u003c/saml:Issuer\u003e\n    \u003csamlp:Status\u003e\n        \u003csamlp:StatusCode Value=\"urn:oasis:names:tc:SAML:2.0:status:Success\" /\u003e\n    \u003c/samlp:Status\u003e\n    \u003csaml:Assertion xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" ID=\"[IDENTITY_PROVIDER_ASSERTION_ID]\"\n        IssueInstant=\"2023-12-17T22:53:41Z\" Version=\"2.0\"\u003e\n        \u003csaml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"\u003e\n            [IDENTITY_PROVIDER]\n        \u003c/saml:Issuer\u003e\n        \u003cds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"\u003e\n            \u003cds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"\u003e\n                \u003cds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" /\u003e\n                \u003cds:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256\" /\u003e\n                \u003cds:Reference URI=\"#[IDENTITY_PROVIDER_ASSERTION_ID]\"\u003e\n                    \u003cds:Transforms\u003e\n                        \u003cds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /\u003e\n                        \u003cds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" /\u003e\n                    \u003c/ds:Transforms\u003e\n                    \u003cds:DigestMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#sha256\" /\u003e\n                    \u003cds:DigestValue\u003e\n                        [SHA-256]\n                    \u003c/ds:DigestValue\u003e\n                \u003c/ds:Reference\u003e\n            \u003c/ds:SignedInfo\u003e\n            \u003cds:SignatureValue\u003e[ASSERTION_SIGNATURE]\u003c/ds:SignatureValue\u003e\n            \u003cds:KeyInfo\u003e\n                \u003cds:X509Data\u003e\n                    \u003cds:X509Certificate\u003e[PUBLIC_KEY]\u003c/ds:X509Certificate\u003e\n                \u003c/ds:X509Data\u003e\n            \u003c/ds:KeyInfo\u003e\n        \u003c/ds:Signature\u003e\n        \u003csaml:Subject\u003e\n            \u003csaml:NameID SPNameQualifier=\"[SERVICE_PROVIDER_METADATA_URL]\"\n                Format=\"urn:oasis:names:tc:SAML:2.0:nameid-format:persistent\"\u003e\n                [NAME_ID_VALUE]\n            \u003c/saml:NameID\u003e\n            \u003csaml:SubjectConfirmation Method=\"urn:oasis:names:tc:SAML:2.0:cm:bearer\"\u003e\n                \u003csaml:SubjectConfirmationData NotBefore=\"2023-12-17T22:53:31Z\" NotOnOrAfter=\"2024-12-16T22:53:41Z\"\n                    Recipient=\"[SERVICE_PROVIDER_ACS]\" InResponseTo=\"[SERVICE_PROVIDER_REQUEST_ID]\" /\u003e\n            \u003c/saml:SubjectConfirmation\u003e\n        \u003c/saml:Subject\u003e\n        \u003csaml:Conditions NotBefore=\"2023-12-17T22:53:41Z\" NotOnOrAfter=\"2023-12-17T23:03:41Z\"\u003e\n            \u003csaml:AudienceRestriction\u003e\n                \u003csaml:Audience\u003e\n                    [SERVICE_PROVIDER_METADATA_URL]\n                \u003c/saml:Audience\u003e\n            \u003c/saml:AudienceRestriction\u003e\n        \u003c/saml:Conditions\u003e\n        \u003csaml:AuthnStatement AuthnInstant=\"2023-12-17T22:53:41Z\" SessionNotOnOrAfter=\"2024-12-16T22:53:41Z\"\n            SessionIndex=\"_ccca26b6-b67b-4bed-9bfa-0ff01f48ce0f\"\u003e\n            \u003csaml:AuthnContext\u003e\n                \u003csaml:AuthnContextClassRef\u003e\n                    urn:oasis:names:tc:SAML:2.0:ac:classes:Password\n                \u003c/saml:AuthnContextClassRef\u003e\n            \u003c/saml:AuthnContext\u003e\n        \u003c/saml:AuthnStatement\u003e\n        \u003csaml:AttributeStatement xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"\u003e\n            \u003csaml:Attribute Name=\"urn:oasis:names:tc:SAML:attribute:...\"\n                NameFormat=\"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\"\u003e\n                \u003csaml:AttributeValue\u003e\n                    ...\n                \u003c/saml:AttributeValue\u003e\n            \u003c/saml:Attribute\u003e\n            ...\n        \u003c/saml:AttributeStatement\u003e\n    \u003c/saml:Assertion\u003e\n\u003c/samlp:Response\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fximaz%2Fsaml-idp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fximaz%2Fsaml-idp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fximaz%2Fsaml-idp/lists"}