Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/ma314smith/go-wsfed

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ma314smith/go-wsfed

  • v0.0.0-20210323005049-7bd424ec050b
  • Source
  • Go
  • Socket score

Version published
Created
Source

go-wsfed

GoDoc

The wsfed package provides functionality for:

  • Generating a redirect url to an IDP
  • Parsing Tokens generated by an IDP (currently only SAML v1.1 Tokens are supported since that was my specific use case, but it wouldn't take much work to add other Tokens)

Install

go get github.com/ma314smith/go-wsfed

Examples

Configuration
  config = wsfed.Config{}
  // set the metatdata url for the IDP (alternatively set the IDPEndpoint)
	config.MetadataURL = "https://idp.example.com/wsfederation/metadata"
  // trust the certs in the metadata (alternatively set the TrustedCerts)
	config.MetadataCertsAreTrusted = true
  // poll the metadata once a week to check for any new certificates.
  // the default is 0 seconds, which never refreshes after the initial poll
	config.MetadataRefreshIntervalSeconds = 604800
  // set your realm
	config.Realm = "http://realm.example.com"
  // use your config to create a new WSFed object
	sso = wsfed.New(&config)
Get the Request URL for the IDP
// get the default request parameters (wa, wtrealm, wct) or create your own
rp := sso.GetDefaultRequestParameters()
// pass the RequestParameters to GetRequestURL
url, err := sso.GetRequestURL(rp)
Parse Claims asserted by the IDP
// get the wresult parameter from the IDP POST
wresult := r.PostFormValue("wresult")
// pass the wresult to ParseResponse
claims, err := sso.ParseResponse(wresult)

Contributions

Contributions are welcome. Just fork the repo and send a pull request.

FAQs

Package last updated on 23 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc