forked from diego-araujo/go-saml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaml.go
90 lines (79 loc) · 2.67 KB
/
saml.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package saml
const (
NameIdFormatPersistent = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
NameIdFormatTransient = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
NameIdFormatEmailAddress = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
NameIdFormatUnspecified = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
NameIdFormatX509SubjectName = "urn:oasis:names:tc:SAML:1.1:nameid-format:x509SubjectName"
HTTPPostBinding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
HTTPRedirectBinding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
AttributeFormatUnspecified = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
AttributeFormatBasic = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
AttributeFormatUri = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
)
// Supported signature algorithms for responses
const (
SignatureAlgorithmRSASHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
SignatureAlgorithmRSASHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
)
// Supported digest algorithms for responses
const (
DigestAlgorithmSHA1 = "http://www.w3.org/2000/09/xmldsig#sha1"
DigestAlgorithmSHA256 = "http://www.w3.org/2001/04/xmlenc#sha256"
)
type IdentityProvider struct {
IsIdpInitiated bool
Issuer string
Audiences []string
IDPCert string
IDPKey string
SPCert string
IDPCertFilePath string
IDPKeyFilePath string
SPCertFilePath string
Attributes []map[string]string
SignatureAlgorithm string // RSA-SHA256 is the default
SignaturePrefix string
DigestAlgorithm string // SHA256 is the default
LifetimeInSeconds int64
NameIdentifier string
NameIdentifierFormat string
ACSLocation string
ACSBinging string
LogoutUrl string
RelayState string
SessionIndex string
SingleSignOnService []MetadataBinding
SingleSignOutService []MetadataBinding
idpPrivateKey interface{}
x509IdpCertificate string
x509SpCertificate string
samlRequestParam *SamlRequestParam
Organization *Organization
ContactPerson *[]ContactPerson
}
type MetadataBinding struct {
Binding string
Location string
}
type Reject struct {
Error error
Reason string
}
type AuthnReq struct {
ID string
ForceAuthn string
IsPassive string
ProviderName string
}
type Organization struct {
OrganizationName string
OrganizationDisplayName string
OrganizationURL string
}
type ContactPerson struct {
ContactType string
GivenName string
SurName string
EmailAddress string
}