Documentation
¶
Index ¶
- func IsValid(x *Response, appSettings *AppSettings, accountSettings *AccountSettings) error
- func LoadCertificate(crtFile string) (string, error)
- func Middleware(c Config, store *sessions.CookieStore, sessionKey string) func(h http.Handler) http.Handler
- func Parse(resp string, appSettings *AppSettings, accountSettings *AccountSettings) (map[string]string, error)
- func VerifySignature(xml string, pubCertPath string) error
- type AccountSettings
- type AppSettings
- type Assertion
- type Attribute
- type AttributeStatement
- type AuthnContextClassRef
- type AuthnRequest
- type AuthnSignedRequest
- type AuthorizationRequest
- type CanonicalizationMethod
- type Conditions
- type Config
- type DigestMethod
- type DigestValue
- type Issuer
- type KeyInfo
- type NameIDPolicy
- type RequestedAuthnContext
- type Response
- type SamlsigReference
- type Signature
- type SignatureMethod
- type SignatureValue
- type SignedInfo
- type Status
- type StatusCode
- type Subject
- type SubjectConfirmation
- type SubjectConfirmationData
- type Transform
- type Transforms
- type X509Certificate
- type X509Data
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValid ¶
func IsValid(x *Response, appSettings *AppSettings, accountSettings *AccountSettings) error
func LoadCertificate ¶
func Middleware ¶
func Parse ¶
func Parse(resp string, appSettings *AppSettings, accountSettings *AccountSettings) (map[string]string, error)
func VerifySignature ¶
Types ¶
type AccountSettings ¶
func NewAccountSettings ¶
func NewAccountSettings(cert string, targetUrl string) AccountSettings
func (*AccountSettings) CertificateString ¶
func (as *AccountSettings) CertificateString() (string, error)
type AppSettings ¶
func NewAppSettings ¶
func NewAppSettings(assertionServiceUrl string, issuer string) AppSettings
type Assertion ¶
type Assertion struct {
XMLName xml.Name
ID string `xml:"ID,attr"`
Version string `xml:"Version,attr"`
SAML string `xml:"saml2,attr"`
IssueInstant string `xml:"IssueInstant,attr"`
Subject Subject
Conditions Conditions
AttributeStatement AttributeStatement
}
type AttributeStatement ¶
type AttributeStatement struct {
Attributes []Attribute `xml:"Attribute"`
}
type AuthnContextClassRef ¶
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"`
}
type AuthnSignedRequest ¶
type AuthnSignedRequest struct {
XMLName xml.Name
SAMLP string `xml:"xmlns:samlp,attr"`
SAML string `xml:"xmlns:saml,attr"`
SAMLSIG string `xml:"xmlns:samlsig,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"`
Signature Signature `xml:"Signature"`
}
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"));
func (AuthorizationRequest) GetSignedRequest ¶
func (ar AuthorizationRequest) GetSignedRequest(base64Encode bool, publicCert string, privateCert string) (string, error)
GetSignedRequest returns a string formatted XML document that represents the SAML document TODO: parameterize more parts of the request
type CanonicalizationMethod ¶
type Conditions ¶
type DigestMethod ¶
type DigestValue ¶
type NameIDPolicy ¶
type RequestedAuthnContext ¶
type RequestedAuthnContext struct {
XMLName xml.Name
SAMLP string `xml:"xmlns:samlp,attr"`
Comparison string `xml:"Comparison,attr"`
AuthnContextClassRef AuthnContextClassRef `xml:"AuthnContextClassRef"`
}
type Response ¶
type Response struct {
XMLName xml.Name
SAMLP string `xml:"saml2p,attr"`
Destination string `xml:"Destination,attr"`
ID string `xml:"ID,attr"`
Version string `xml:"Version,attr"`
IssueInstant string `xml:"IssueInstant,attr"`
Assertion Assertion `xml:"Assertion"`
Signature Signature `xml:"Signature"`
Issuer Issuer `xml:"Issuer"`
Status Status `xml:"Status"`
}
type SamlsigReference ¶
type SamlsigReference struct {
XMLName xml.Name
URI string `xml:"URI,attr"`
Transforms Transforms `xml:",innerxml"`
DigestMethod DigestMethod `xml:",innerxml"`
DigestValue DigestValue `xml:",innerxml"`
}
type Signature ¶
type Signature struct {
XMLName xml.Name
Id string `xml:"Id,attr"`
SignedInfo SignedInfo
SignatureValue SignatureValue
KeyInfo KeyInfo
}
type SignatureMethod ¶
type SignatureValue ¶
type SignedInfo ¶
type SignedInfo struct {
XMLName xml.Name
CanonicalizationMethod CanonicalizationMethod
SignatureMethod SignatureMethod
SamlsigReference SamlsigReference
}
type Status ¶
type Status struct {
XMLName xml.Name
StatusCode StatusCode `xml:"StatusCode"`
}
type StatusCode ¶
type StatusCode struct {
Value string `xml:"Value"`
}
type Subject ¶
type Subject struct {
XMLName xml.Name
SubjectConfirmation SubjectConfirmation
}
type SubjectConfirmation ¶
type SubjectConfirmation struct {
XMLName xml.Name
Method string `xml:",attr"`
SubjectConfirmationData SubjectConfirmationData
}
type SubjectConfirmationData ¶
type Transforms ¶
type X509Certificate ¶
type X509Data ¶
type X509Data struct {
XMLName xml.Name
X509Certificate X509Certificate `xml:",innerxml"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.