@@ -55,6 +55,7 @@ type ServiceProvider struct {
55
55
56
56
// Certificate is the RSA public part of Key.
57
57
Certificate * x509.Certificate
58
+ Intermediates []* x509.Certificate
58
59
59
60
// MetadataURL is the full URL to the metadata endpoint on this host,
60
61
// i.e. https://example.com/saml/metadata
@@ -112,6 +113,10 @@ func (sp *ServiceProvider) Metadata() *EntityDescriptor {
112
113
authnRequestsSigned := false
113
114
wantAssertionsSigned := true
114
115
validUntil := TimeNow ().Add (validDuration )
116
+ certBytes := sp .Certificate .Raw
117
+ for _ , intermediate := range sp .Intermediates {
118
+ certBytes = append (certBytes , intermediate .Raw ... )
119
+ }
115
120
return & EntityDescriptor {
116
121
EntityID : sp .MetadataURL .String (),
117
122
ValidUntil : validUntil ,
@@ -125,13 +130,13 @@ func (sp *ServiceProvider) Metadata() *EntityDescriptor {
125
130
{
126
131
Use : "signing" ,
127
132
KeyInfo : KeyInfo {
128
- Certificate : base64 .StdEncoding .EncodeToString (sp . Certificate . Raw ),
133
+ Certificate : base64 .StdEncoding .EncodeToString (certBytes ),
129
134
},
130
135
},
131
136
{
132
137
Use : "encryption" ,
133
138
KeyInfo : KeyInfo {
134
- Certificate : base64 .StdEncoding .EncodeToString (sp . Certificate . Raw ),
139
+ Certificate : base64 .StdEncoding .EncodeToString (certBytes ),
135
140
},
136
141
EncryptionMethods : []EncryptionMethod {
137
142
{Algorithm : "http://www.w3.org/2001/04/xmlenc#aes128-cbc" },
0 commit comments