gosaml

package module
v0.0.0-...-f0ad12e Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2014 License: Apache-2.0 Imports: 10 Imported by: 0

README

gosaml

SAML client library written in Go (golang)

SAML is the successful OASIS standard for cloud based single sign on (SSO). SAML allows for companies that maintain a security infrastructure internally to allow using that same set of credentials via a safe, secure mechanism with externally hosted services.

For instance, New Relic allows you to configure a saml provider (https://newrelic.com/docs/subscriptions/saml-service-providers) so you can maintain your own credentials instead of using New Relic's.

Ping Identity has a nice video for SAML here: https://www.pingidentity.com/resource-center/Introduction-to-SAML-Video.cfm

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCertificate

func LoadCertificate(crtFile string) (*x509.Certificate, error)

func LoadCertificateFromBytes

func LoadCertificateFromBytes(cert []byte) (*x509.Certificate, error)

Types

type AccountSettings

type AccountSettings struct {
	Certificate        string
	IDP_SSO_Target_URL string
}

func NewAccountSettings

func NewAccountSettings(cert string, targetUrl string) *AccountSettings

type AppSettings

type AppSettings struct {
	AssertionConsumerServiceURL string
	Issuer                      string
}

func NewAppSettings

func NewAppSettings(assertionServiceUrl string, issuer string) *AppSettings

type AuthnContextClassRef

type AuthnContextClassRef struct {
	XMLName   xml.Name
	SAML      string `xml:"xmlns:saml,attr"`
	Transport string `xml:",innerxml"`
}

type AuthnRequest

type AuthnRequest struct {
	XMLName                        xml.Name
	SAMLP                          string                `xml:"xmlns:samlp,attr"`
	SAML                           string                `xml:"xmlns:saml,attr"`
	ID                             string                `xml:"ID,attr"`
	Version                        string                `xml:"Version,attr"`
	ProtocolBinding                string                `xml:"ProtocolBinding,attr"`
	AssertionConsumerServiceURL    string                `xml:"AssertionConsumerServiceURL,attr"`
	IssueInstant                   string                `xml:"IssueInstant,attr"`
	AssertionConsumerServiceIndex  int                   `xml:"AssertionConsumerServiceIndex,attr"`
	AttributeConsumingServiceIndex int                   `xml:"AttributeConsumingServiceIndex,attr"`
	Issuer                         Issuer                `xml:"Issuer"`
	NameIDPolicy                   NameIDPolicy          `xml:"NameIDPolicy"`
	RequestedAuthnContext          RequestedAuthnContext `xml:"RequestedAuthnContext"`
	AuthnContextClassRef           AuthnContextClassRef  `xml:"AuthnContextClassRef"`
}

type AuthorizationRequest

type AuthorizationRequest struct {
	Id              string
	IssueInstant    string
	AppSettings     AppSettings
	AccountSettings AccountSettings
	Base64          int
}

func NewAuthorizationRequest

func NewAuthorizationRequest(appSettings AppSettings, accountSettings AccountSettings) *AuthorizationRequest

func (AuthorizationRequest) GetRequest

func (ar AuthorizationRequest) GetRequest(base64Encode bool) (string, error)

GetRequest returns a string formatted XML document that represents the SAML document TODO: parameterize more parts of the request

func (AuthorizationRequest) GetRequestUrl

func (ar AuthorizationRequest) GetRequestUrl() (string, error)

String reqString = accSettings.getIdp_sso_target_url()+"?SAMLRequest=" + AuthRequest.getRidOfCRLF(URLEncoder.encode(authReq.getRequest(AuthRequest.base64),"UTF-8"));

type Issuer

type Issuer struct {
	XMLName xml.Name
	Url     string `xml:",innerxml"`
}

type NameIDPolicy

type NameIDPolicy struct {
	XMLName     xml.Name
	AllowCreate bool   `xml:"AllowCreate,attr"`
	Format      string `xml:"Format,attr"`
}

type RequestedAuthnContext

type RequestedAuthnContext struct {
	XMLName    xml.Name
	SAMLP      string `xml:"xmlns:samlp,attr"`
	Comparison string `xml:"Comparison,attr"`
}

type Response

type Response struct {
	XmlDoc   string
	Settings AccountSettings
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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