{"id":15333917,"url":"https://github.com/LoginRadius/go-saml","last_synced_at":"2025-10-10T06:30:22.042Z","repository":{"id":54895229,"uuid":"296618552","full_name":"LoginRadius/go-saml","owner":"LoginRadius","description":"High Level API Implementation of SAML 2.0 (Currently Supported Identity Provider Implementation) Single Sign On","archived":false,"fork":false,"pushed_at":"2021-01-21T16:26:39.000Z","size":87,"stargazers_count":11,"open_issues_count":8,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-11T09:26:04.548Z","etag":null,"topics":["federation","go","golang","hacktoberfest","hacktoberfest2021","saml","sso"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LoginRadius.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-18T12:44:41.000Z","updated_at":"2024-08-02T11:26:26.000Z","dependencies_parsed_at":"2022-08-14T06:00:51.364Z","dependency_job_id":null,"html_url":"https://github.com/LoginRadius/go-saml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LoginRadius/go-saml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoginRadius%2Fgo-saml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoginRadius%2Fgo-saml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoginRadius%2Fgo-saml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoginRadius%2Fgo-saml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LoginRadius","download_url":"https://codeload.github.com/LoginRadius/go-saml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoginRadius%2Fgo-saml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002960,"owners_count":26083489,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["federation","go","golang","hacktoberfest","hacktoberfest2021","saml","sso"],"created_at":"2024-10-01T10:05:08.036Z","updated_at":"2025-10-10T06:30:21.684Z","avatar_url":"https://github.com/LoginRadius.png","language":"Go","funding_links":[],"categories":["LoginRadius Open Source Documentation"],"sub_categories":[],"readme":"# go-saml\nHigh-level API library for Single Sign On with SAML 2.0 based on  [etree](https://github.com/beevik/etree) and [signedxml](https://github.com/ma314smith/signedxml), a pure Go implementation.\nThe library provides the Identity Provider Implementation with support of both IDPInitiated and SPInitiated flow.\n\n## Features\n* Generating identity provider metadata\n* Validating Redirect/Post Binding signed/unsigned AuthnRequests\n* Generating Post signed Responses\n* Validating Redirect/Post Binding signed/unsigned LogoutRequest\n* Generating Post signed LogoutResponses\n* SessionIndex\n\n## Installation\nInstall `go-saml` into your `$GOPATH` using go get:\n```\ngo get github.com/LoginRadius/go-saml\n```\n## Usage\nBelow are samples to show how you might use the library.\n\n### Create Idp Provider Instance\n```\nidp := saml.IdentityProvider{\n    IsIdpInitiated:       false,\n    Issuer:               \"https://identity-provider.com/\",\n    Audiences:            \"https://service-provider.com/\",\n    IDPCert:              \"\u003cIDPCert PEM Format\u003e\",\n    IDPKey:               \"\u003cIDPKey PEM Format\u003e\",\n    SPCert:               \"\u003cSPCert PEM Format\u003e\",\n    NameIdentifier:       \"john@idp.com\",\n    NameIdentifierFormat: saml.AttributeFormatUnspecified,\n    ACSLocation:          \"https://service-provider-acs.com\", //Service Provider Login Url\n    ACSBinging:           saml.HTTPPostBinding,\n    SessionIndex:         \"1ac5bc03-06a1-413d-8542-e7a7e7d9e9f2\",\n    LogoutUrl:            \"https://service-provider-acs.com/logout\" //Service Provider Logout Url\n}\n\n//Add Attributes\nidp.AddAttribute(\"Fname\", \"john\", saml.AttributeFormatUnspecified)\n```\n\n### Validate and Parse AuthnRequest\n```\n//This validate the AuthnRequest and set parsed value in the idp instance, \n//that used in Generating the SAML Response with InResponseTo property.\n\n//Get Querystring and Payload values from request with url.Value{} type\nvalidationError := idp.ValidateAuthnRequest(method\"POST\",query url.Values,payload url.Values);\nif validationError !=nil {\n  return validationError\n}\n```\n\n### Generate Login Response\n```\nsignedXML, signedXMLErr := idp.NewSignedLoginResponse()\nif signedXMLErr != nil {\n    return signedXMLErr\n}\n\n//Generate html content for Post\nhtml, err := idp.ResponseHtml(signedXML, \"Response\")\nif err !=nil {\n  return err\n}\n```\n### Validate and Parse Logout Request\n```\n//This validate the AuthnRequest and set parsed value in the idp instance, \n//that is used in Generating the SAML Logout Response with InResponseTo property\n\n//Get Querystring and Payload values from request with url.Value{} type\nvalidationError := idp.ValidateLogoutRequest(method\"POST\",query url.Values,payload url.Values);\nif validationError !=nil {\n  return validationError\n}\n```\n\n### Generate Logout Response\n```\nsignedXML, signedXMLErr := idp.NewSignedLoginResponse()\nif signedXMLErr != nil {\n    return signedXMLErr\n}\n\n//Generate html content for Post\nhtml, err := idp.ResponseHtml(signedXML, \"LogoutResponse\")\nif err !=nil {\n  return err\n}\n```\n\n### Metadata Identity Provider\n```\nidp := saml.IdentityProvider{\n    Issuer:               \"https://identity-provider.com/\",\n    Audiences:            \"https://service-provider.com/\",\n    IDPCert:              \"\u003cIDPCert PEM Format\u003e\",\n    NameIdentifierFormat: saml.AttributeFormatUnspecified,\n}\n\nidp.AddSingleSignOnService(saml.MetadataBinding{\n    Binding:  saml.HTTPPostBinding,\n    Location: \"https://identity-provider.com/saml/post\",\n})\n\nidp.AddSingleSignOnService(saml.MetadataBinding{\n    Binding:  saml.HTTPRedirectBinding,\n    Location: \"https://identity-provider.com/saml/redirect\",\n})\n\nidp.AddSingleSignOutService(saml.MetadataBinding{\n    Binding:  saml.HTTPPostBinding,\n    Location: \"https://identity-provider.com/saml/post/logout\",\n})\n\n// Generate xml for IDP Metadata\nxml, xmlerr :=  idp.MetaDataResponse()\n\n```\n### Example\nPlease see [examples](examples) for how to use the library to be an identity provider.\n\n## Contributing\nWould love any contribution by you, including better documentation, tests or more robust functionality. Please follow the [contributing guide](CONTRIBUTING.md)\n\n## License\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLoginRadius%2Fgo-saml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLoginRadius%2Fgo-saml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLoginRadius%2Fgo-saml/lists"}