samltools

package module
v0.0.0-...-290da1f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 13 Imported by: 0

README

samltools

A playground to learn SAML. The source contains a simple Service Provider and an Identity Provider. As of now, Service Provider is tested with Auth0 and Okta. IDP is tested with Auth0.

How to setup a service provider locally?

  • Clone the repo
  • Setup a loopback mapping to "sp.samltools.com". For example on mac, I do the following
Edit /etc/hosts to add 127.0.0.7 sp.samltools.com
Run sudo ifconfig lo0 alias 127.0.0.7 up
  • You should be able to use the IDP configured in spconfig.yml as-is
  • Start the Service Provider
$ cd sp
$ go run samlsp.go

SP Home

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Certb64 = `` /* 1272-byte string literal not displayed */

Test Cert

Functions

func CreateSAMLResponse

func CreateSAMLResponse(issuer string, inRespTo string, recipient string, audience string, signingCtx *dsig.SigningContext) (string, error)

func CreateValidationContextFromCertFile

func CreateValidationContextFromCertFile(certFile string) (*dsig.ValidationContext, error)

func NewIDPKeyStore

func NewIDPKeyStore(pKeyFile string) dsig.X509KeyStore

func ValidateAssertion

func ValidateAssertion(base64EncResp string, validationContext *dsig.ValidationContext) error

Types

type AuthnRequest

type AuthnRequest struct {
	XMLName         xml.Name `xml:"samlp:AuthnRequest"`
	SamlpAttr       string   `xml:"xmlns:samlp,attr"`
	ID              string   `xml:"ID,attr"`
	IssueInstant    string   `xml:"IssueInstant,attr"`
	ProtocolBinding string   `xml:"ProtocolBinding,attr"`
	Version         string   `xml:"Version,attr"`
	Issuer          Issuer   `xml:"saml:Issuer"`
}

type IDPKeyStore

type IDPKeyStore struct {
	// contains filtered or unexported fields
}

func (*IDPKeyStore) GetKeyPair

func (is *IDPKeyStore) GetKeyPair() (privateKey *rsa.PrivateKey, cert []byte, err error)

type Issuer

type Issuer struct {
	Namespace string `xml:"xmlns:saml,attr"`
	Value     string `xml:",chardata"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL