refactory: s/initFrom/initWith/g
[moonshot.git] / mech_eap / util_saml.cpp
1 /*
2  * Copyright (c) 2011, JANET(UK)
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * 3. Neither the name of JANET(UK) nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  */
32
33 /*
34  * SAML attribute provider implementation.
35  */
36
37 #include "gssapiP_eap.h"
38
39 #include <sstream>
40
41 #include <xercesc/util/XMLUniDefs.hpp>
42 #include <xmltooling/unicode.h>
43 #include <xmltooling/XMLToolingConfig.h>
44 #include <xmltooling/util/XMLHelper.h>
45 #include <xmltooling/util/ParserPool.h>
46 #include <xmltooling/util/DateTime.h>
47
48 #include <saml/exceptions.h>
49 #include <saml/saml1/core/Assertions.h>
50 #include <saml/saml2/core/Assertions.h>
51 #include <saml/saml2/metadata/Metadata.h>
52 #include <saml/saml2/metadata/MetadataProvider.h>
53
54 using namespace xmltooling;
55 using namespace opensaml::saml2md;
56 using namespace opensaml;
57 using namespace xercesc;
58 using namespace std;
59
60 /*
61  * gss_eap_saml_assertion_provider is for retrieving the underlying
62  * assertion.
63  */
64 gss_eap_saml_assertion_provider::gss_eap_saml_assertion_provider(void)
65 {
66     m_assertion = NULL;
67     m_authenticated = false;
68 }
69
70 gss_eap_saml_assertion_provider::~gss_eap_saml_assertion_provider(void)
71 {
72     delete m_assertion;
73 }
74
75 bool
76 gss_eap_saml_assertion_provider::initWithExistingContext(const gss_eap_attr_ctx *manager,
77                                                          const gss_eap_attr_provider *ctx)
78 {
79     /* Then we may be creating from an existing attribute context */
80     const gss_eap_saml_assertion_provider *saml;
81
82     assert(m_assertion == NULL);
83
84     if (!gss_eap_attr_provider::initWithExistingContext(manager, ctx))
85         return false;
86
87     saml = static_cast<const gss_eap_saml_assertion_provider *>(ctx);
88     setAssertion(saml->getAssertion(), saml->authenticated());
89
90     return true;
91 }
92
93 bool
94 gss_eap_saml_assertion_provider::initWithGssContext(const gss_eap_attr_ctx *manager,
95                                                     const gss_cred_id_t gssCred,
96                                                     const gss_ctx_id_t gssCtx)
97 {
98     const gss_eap_radius_attr_provider *radius;
99     gss_buffer_desc value = GSS_C_EMPTY_BUFFER;
100     int authenticated, complete;
101     OM_uint32 minor;
102
103     assert(m_assertion == NULL);
104
105     if (!gss_eap_attr_provider::initWithGssContext(manager, gssCred, gssCtx))
106         return false;
107
108     /*
109      * XXX TODO we need to support draft-howlett-radius-saml-attr-00
110      */
111     radius = static_cast<const gss_eap_radius_attr_provider *>
112         (m_manager->getProvider(ATTR_TYPE_RADIUS));
113     if (radius != NULL &&
114         radius->getFragmentedAttribute(PW_SAML_AAA_ASSERTION,
115                                        VENDORPEC_UKERNA,
116                                        &authenticated, &complete, &value)) {
117         setAssertion(&value, authenticated);
118         gss_release_buffer(&minor, &value);
119     } else {
120         m_assertion = NULL;
121     }
122
123     return true;
124 }
125
126 void
127 gss_eap_saml_assertion_provider::setAssertion(const saml2::Assertion *assertion,
128                                               bool authenticated)
129 {
130
131     delete m_assertion;
132
133     if (assertion != NULL) {
134 #ifdef __APPLE__
135         m_assertion = (saml2::Assertion *)((void *)assertion->clone());
136 #else
137         m_assertion = dynamic_cast<saml2::Assertion *>(assertion->clone());
138 #endif
139         m_authenticated = authenticated;
140     } else {
141         m_assertion = NULL;
142         m_authenticated = false;
143     }
144 }
145
146 void
147 gss_eap_saml_assertion_provider::setAssertion(const gss_buffer_t buffer,
148                                               bool authenticated)
149 {
150     delete m_assertion;
151
152     m_assertion = parseAssertion(buffer);
153     m_authenticated = (m_assertion != NULL && authenticated);
154 }
155
156 saml2::Assertion *
157 gss_eap_saml_assertion_provider::parseAssertion(const gss_buffer_t buffer)
158 {
159     string str((char *)buffer->value, buffer->length);
160     istringstream istream(str);
161     DOMDocument *doc;
162     const XMLObjectBuilder *b;
163
164     try {
165         doc = XMLToolingConfig::getConfig().getParser().parse(istream);
166         if (doc == NULL)
167             return NULL;
168
169         b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
170
171 #ifdef __APPLE__
172         return (saml2::Assertion *)((void *)b->buildFromDocument(doc));
173 #else
174         return dynamic_cast<saml2::Assertion *>(b->buildFromDocument(doc));
175 #endif
176     } catch (exception &e) {
177         return NULL;
178     }
179 }
180
181 bool
182 gss_eap_saml_assertion_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAttribute,
183                                                    void *data) const
184 {
185     bool ret;
186
187     /* just add the prefix */
188     if (m_assertion != NULL)
189         ret = addAttribute(m_manager, this, GSS_C_NO_BUFFER, data);
190     else
191         ret = true;
192
193     return ret;
194 }
195
196 bool
197 gss_eap_saml_assertion_provider::setAttribute(int complete GSSEAP_UNUSED,
198                                               const gss_buffer_t attr,
199                                               const gss_buffer_t value)
200 {
201     if (attr == GSS_C_NO_BUFFER || attr->length == 0) {
202         setAssertion(value);
203         return true;
204     }
205
206     return false;
207 }
208
209 bool
210 gss_eap_saml_assertion_provider::deleteAttribute(const gss_buffer_t value GSSEAP_UNUSED)
211 {
212     delete m_assertion;
213     m_assertion = NULL;
214     m_authenticated = false;
215
216     return true;
217 }
218
219 time_t
220 gss_eap_saml_assertion_provider::getExpiryTime(void) const
221 {
222     saml2::Conditions *conditions;
223     time_t expiryTime = 0;
224
225     if (m_assertion == NULL)
226         return 0;
227
228     conditions = m_assertion->getConditions();
229
230     if (conditions != NULL && conditions->getNotOnOrAfter() != NULL)
231         expiryTime = conditions->getNotOnOrAfter()->getEpoch();
232
233     return expiryTime;
234 }
235
236 OM_uint32
237 gss_eap_saml_assertion_provider::mapException(OM_uint32 *minor,
238                                               std::exception &e) const
239 {
240     if (typeid(e) == typeid(SecurityPolicyException))
241         *minor = GSSEAP_SAML_SEC_POLICY_FAILURE;
242     else if (typeid(e) == typeid(BindingException))
243         *minor = GSSEAP_SAML_BINDING_FAILURE;
244     else if (typeid(e) == typeid(ProfileException))
245         *minor = GSSEAP_SAML_PROFILE_FAILURE;
246     else if (typeid(e) == typeid(FatalProfileException))
247         *minor = GSSEAP_SAML_FATAL_PROFILE_FAILURE;
248     else if (typeid(e) == typeid(RetryableProfileException))
249         *minor = GSSEAP_SAML_RETRY_PROFILE_FAILURE;
250     else if (typeid(e) == typeid(MetadataException))
251         *minor = GSSEAP_SAML_METADATA_FAILURE;
252     else
253         return GSS_S_CONTINUE_NEEDED;
254
255     gssEapSaveStatusInfo(*minor, "%s", e.what());
256
257     return GSS_S_FAILURE;
258 }
259
260 bool
261 gss_eap_saml_assertion_provider::getAttribute(const gss_buffer_t attr,
262                                               int *authenticated,
263                                               int *complete,
264                                               gss_buffer_t value,
265                                               gss_buffer_t display_value GSSEAP_UNUSED,
266                                               int *more) const
267 {
268     string str;
269
270     if (attr != GSS_C_NO_BUFFER && attr->length != 0)
271         return false;
272
273     if (m_assertion == NULL)
274         return false;
275
276     if (*more != -1)
277         return false;
278
279     if (authenticated != NULL)
280         *authenticated = m_authenticated;
281     if (complete != NULL)
282         *complete = true;
283
284     XMLHelper::serialize(m_assertion->marshall((DOMDocument *)NULL), str);
285
286     duplicateBuffer(str, value);
287     *more = 0;
288
289     return true;
290 }
291
292 gss_any_t
293 gss_eap_saml_assertion_provider::mapToAny(int authenticated,
294                                           gss_buffer_t type_id GSSEAP_UNUSED) const
295 {
296     if (authenticated && !m_authenticated)
297         return (gss_any_t)NULL;
298
299     return (gss_any_t)m_assertion;
300 }
301
302 void
303 gss_eap_saml_assertion_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UNUSED,
304                                                        gss_any_t input) const
305 {
306     delete ((saml2::Assertion *)input);
307 }
308
309 const char *
310 gss_eap_saml_assertion_provider::prefix(void) const
311 {
312     return "urn:ietf:params:gss-eap:saml-aaa-assertion";
313 }
314
315 bool
316 gss_eap_saml_assertion_provider::init(void)
317 {
318     gss_eap_attr_ctx::registerProvider(ATTR_TYPE_SAML_ASSERTION, createAttrContext);
319     return true;
320 }
321
322 void
323 gss_eap_saml_assertion_provider::finalize(void)
324 {
325     gss_eap_attr_ctx::unregisterProvider(ATTR_TYPE_SAML_ASSERTION);
326 }
327
328 gss_eap_attr_provider *
329 gss_eap_saml_assertion_provider::createAttrContext(void)
330 {
331     return new gss_eap_saml_assertion_provider;
332 }
333
334 saml2::Assertion *
335 gss_eap_saml_assertion_provider::initAssertion(void)
336 {
337     delete m_assertion;
338     m_assertion = saml2::AssertionBuilder::buildAssertion();
339     m_authenticated = false;
340
341     return m_assertion;
342 }
343
344 /*
345  * gss_eap_saml_attr_provider is for retrieving the underlying attributes.
346  */
347 bool
348 gss_eap_saml_attr_provider::getAssertion(int *authenticated,
349                                          saml2::Assertion **pAssertion,
350                                          bool createIfAbsent) const
351 {
352     gss_eap_saml_assertion_provider *saml;
353
354     if (authenticated != NULL)
355         *authenticated = false;
356     if (pAssertion != NULL)
357         *pAssertion = NULL;
358
359     saml = static_cast<const gss_eap_saml_assertion_provider *>
360         (m_manager->getProvider(ATTR_TYPE_SAML_ASSERTION));
361     if (saml == NULL)
362         return false;
363
364     if (authenticated != NULL)
365         *authenticated = saml->authenticated();
366     if (pAssertion != NULL)
367         *pAssertion = saml->getAssertion();
368
369     if (saml->getAssertion() == NULL) {
370         if (createIfAbsent) {
371             if (authenticated != NULL)
372                 *authenticated = false;
373             if (pAssertion != NULL)
374                 *pAssertion = saml->initAssertion();
375         } else
376             return false;
377     }
378
379     return true;
380 }
381
382 bool
383 gss_eap_saml_attr_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAttribute,
384                                               void *data) const
385 {
386     saml2::Assertion *assertion;
387     int authenticated;
388
389     if (!getAssertion(&authenticated, &assertion))
390         return true;
391
392     /*
393      * Note: the first prefix is added by the attribute provider manager
394      *
395      * From draft-hartman-gss-eap-naming-00:
396      *
397      *   Each attribute carried in the assertion SHOULD also be a GSS name
398      *   attribute.  The name of this attribute has three parts, all separated
399      *   by an ASCII space character.  The first part is
400      *   urn:ietf:params:gss-eap:saml-attr.  The second part is the URI for
401      *   the SAML attribute name format.  The final part is the name of the
402      *   SAML attribute.  If the mechanism performs an additional attribute
403      *   query, the retrieved attributes SHOULD be GSS-API name attributes
404      *   using the same name syntax.
405      */
406     /* For each attribute statement, look for an attribute match */
407     const vector <saml2::AttributeStatement *> &statements =
408         const_cast<const saml2::Assertion *>(assertion)->getAttributeStatements();
409
410     for (vector<saml2::AttributeStatement *>::const_iterator s = statements.begin();
411         s != statements.end();
412         ++s) {
413         const vector<saml2::Attribute*> &attrs =
414             const_cast<const saml2::AttributeStatement*>(*s)->getAttributes();
415
416         for (vector<saml2::Attribute*>::const_iterator a = attrs.begin(); a != attrs.end(); ++a) {
417             const XMLCh *attributeName, *attributeNameFormat;
418             XMLCh *qualifiedName;
419             XMLCh space[2] = { ' ', 0 };
420             gss_buffer_desc utf8;
421             bool ret;
422
423             attributeName = (*a)->getName();
424             attributeNameFormat = (*a)->getNameFormat();
425             if (attributeNameFormat == NULL || attributeNameFormat[0] == '\0')
426                 attributeNameFormat = saml2::Attribute::UNSPECIFIED;
427
428             qualifiedName = new XMLCh[XMLString::stringLen(attributeNameFormat) + 1 +
429                                       XMLString::stringLen(attributeName) + 1];
430             XMLString::copyString(qualifiedName, attributeNameFormat);
431             XMLString::catString(qualifiedName, space);
432             XMLString::catString(qualifiedName, attributeName);
433
434             utf8.value = (void *)toUTF8(qualifiedName);
435             utf8.length = strlen((char *)utf8.value);
436
437             ret = addAttribute(m_manager, this, &utf8, data);
438
439             delete qualifiedName;
440
441             if (!ret)
442                 return ret;
443         }
444     }
445
446     return true;
447 }
448
449 static BaseRefVectorOf<XMLCh> *
450 decomposeAttributeName(const gss_buffer_t attr)
451 {
452     XMLCh *qualifiedAttr = new XMLCh[attr->length + 1];
453     XMLString::transcode((const char *)attr->value, qualifiedAttr, attr->length);
454
455     BaseRefVectorOf<XMLCh> *components = XMLString::tokenizeString(qualifiedAttr);
456
457     delete qualifiedAttr;
458
459     if (components->size() != 2) {
460         delete components;
461         components = NULL;
462     }
463
464     return components;
465 }
466
467 bool
468 gss_eap_saml_attr_provider::setAttribute(int complete GSSEAP_UNUSED,
469                                          const gss_buffer_t attr,
470                                          const gss_buffer_t value)
471 {
472     saml2::Assertion *assertion;
473     saml2::Attribute *attribute;
474     saml2::AttributeValue *attributeValue;
475     saml2::AttributeStatement *attributeStatement;
476
477     if (!getAssertion(NULL, &assertion, true))
478         return false;
479
480     if (assertion->getAttributeStatements().size() != 0) {
481         attributeStatement = assertion->getAttributeStatements().front();
482     } else {
483         attributeStatement = saml2::AttributeStatementBuilder::buildAttributeStatement();
484         assertion->getAttributeStatements().push_back(attributeStatement);
485     }
486
487     /* Check the attribute name consists of name format | whsp | name */
488     BaseRefVectorOf<XMLCh> *components = decomposeAttributeName(attr);
489     if (components == NULL)
490         return false;
491
492     attribute = saml2::AttributeBuilder::buildAttribute();
493     attribute->setNameFormat(components->elementAt(0));
494     attribute->setName(components->elementAt(1));
495
496     XMLCh *xmlValue = new XMLCh[value->length + 1];
497     XMLString::transcode((const char *)value->value, xmlValue, attr->length);
498
499     attributeValue = saml2::AttributeValueBuilder::buildAttributeValue();
500     attributeValue->setTextContent(xmlValue);
501
502     attribute->getAttributeValues().push_back(attributeValue);
503
504     assert(attributeStatement != NULL);
505     attributeStatement->getAttributes().push_back(attribute);
506
507     delete components;
508     delete xmlValue;
509
510     return true;
511 }
512
513 bool
514 gss_eap_saml_attr_provider::deleteAttribute(const gss_buffer_t attr)
515 {
516     saml2::Assertion *assertion;
517     bool ret = false;
518
519     if (!getAssertion(NULL, &assertion) ||
520         assertion->getAttributeStatements().size() == 0)
521         return false;
522
523     /* Check the attribute name consists of name format | whsp | name */
524     BaseRefVectorOf<XMLCh> *components = decomposeAttributeName(attr);
525     if (components == NULL)
526         return false;
527
528     /* For each attribute statement, look for an attribute match */
529     const vector<saml2::AttributeStatement *> &statements =
530         const_cast<const saml2::Assertion *>(assertion)->getAttributeStatements();
531
532     for (vector<saml2::AttributeStatement *>::const_iterator s = statements.begin();
533         s != statements.end();
534         ++s) {
535         const vector<saml2::Attribute *> &attrs =
536             const_cast<const saml2::AttributeStatement *>(*s)->getAttributes();
537         ssize_t index = -1, i = 0;
538
539         /* There's got to be an easier way to do this */
540         for (vector<saml2::Attribute *>::const_iterator a = attrs.begin();
541              a != attrs.end();
542              ++a) {
543             if (XMLString::equals((*a)->getNameFormat(), components->elementAt(0)) &&
544                 XMLString::equals((*a)->getName(), components->elementAt(1))) {
545                 index = i;
546                 break;
547             }
548             ++i;
549         }
550         if (index != -1) {
551             (*s)->getAttributes().erase((*s)->getAttributes().begin() + index);
552             ret = true;
553         }
554     }
555
556     delete components;
557
558     return ret;
559 }
560
561 bool
562 gss_eap_saml_attr_provider::getAttribute(const gss_buffer_t attr,
563                                          int *authenticated,
564                                          int *complete,
565                                          const saml2::Attribute **pAttribute) const
566 {
567     saml2::Assertion *assertion;
568
569     if (authenticated != NULL)
570         *authenticated = false;
571     if (complete != NULL)
572         *complete = true;
573     *pAttribute = NULL;
574
575     if (!getAssertion(authenticated, &assertion) ||
576         assertion->getAttributeStatements().size() == 0)
577         return false;
578
579     /* Check the attribute name consists of name format | whsp | name */
580     BaseRefVectorOf<XMLCh> *components = decomposeAttributeName(attr);
581     if (components == NULL)
582         return false;
583
584     /* For each attribute statement, look for an attribute match */
585     const vector <saml2::AttributeStatement *> &statements =
586         const_cast<const saml2::Assertion *>(assertion)->getAttributeStatements();
587     const saml2::Attribute *ret = NULL;
588
589     for (vector<saml2::AttributeStatement *>::const_iterator s = statements.begin();
590         s != statements.end();
591         ++s) {
592         const vector<saml2::Attribute *> &attrs =
593             const_cast<const saml2::AttributeStatement*>(*s)->getAttributes();
594
595         for (vector<saml2::Attribute *>::const_iterator a = attrs.begin(); a != attrs.end(); ++a) {
596             const XMLCh *attributeName, *attributeNameFormat;
597
598             attributeName = (*a)->getName();
599             attributeNameFormat = (*a)->getNameFormat();
600             if (attributeNameFormat == NULL || attributeNameFormat[0] == '\0')
601                 attributeNameFormat = saml2::Attribute::UNSPECIFIED;
602
603             if (XMLString::equals(attributeNameFormat, components->elementAt(0)) &&
604                 XMLString::equals(attributeName, components->elementAt(1))) {
605                 ret = *a;
606                 break;
607             }
608         }
609
610         if (ret != NULL)
611             break;
612     }
613
614     delete components;
615
616     *pAttribute = ret;
617
618     return (ret != NULL);
619 }
620
621 bool
622 gss_eap_saml_attr_provider::getAttribute(const gss_buffer_t attr,
623                                          int *authenticated,
624                                          int *complete,
625                                          gss_buffer_t value,
626                                          gss_buffer_t display_value,
627                                          int *more) const
628 {
629     const saml2::Attribute *a;
630     const saml2::AttributeValue *av;
631     int nvalues, i = *more;
632
633     *more = 0;
634
635     if (!getAttribute(attr, authenticated, complete, &a))
636         return false;
637
638     nvalues = a->getAttributeValues().size();
639
640     if (i == -1)
641         i = 0;
642     else if (i >= nvalues)
643         return false;
644 #ifdef __APPLE__
645     av = (const saml2::AttributeValue *)((void *)(a->getAttributeValues().at(i)));
646 #else
647     av = dynamic_cast<const saml2::AttributeValue *>(a->getAttributeValues().at(i));
648 #endif
649     if (av != NULL) {
650         if (value != NULL) {
651             value->value = toUTF8(av->getTextContent(), true);
652             value->length = strlen((char *)value->value);
653         }
654         if (display_value != NULL) {
655             display_value->value = toUTF8(av->getTextContent(), true);
656             display_value->length = strlen((char *)value->value);
657         }
658     }
659
660     if (nvalues > ++i)
661         *more = i;
662
663     return true;
664 }
665
666 gss_any_t
667 gss_eap_saml_attr_provider::mapToAny(int authenticated GSSEAP_UNUSED,
668                                      gss_buffer_t type_id GSSEAP_UNUSED) const
669 {
670     return (gss_any_t)NULL;
671 }
672
673 void
674 gss_eap_saml_attr_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UNUSED,
675                                                   gss_any_t input GSSEAP_UNUSED) const
676 {
677 }
678
679 const char *
680 gss_eap_saml_attr_provider::prefix(void) const
681 {
682     return "urn:ietf:params:gss-eap:saml-attr";
683 }
684
685 bool
686 gss_eap_saml_attr_provider::init(void)
687 {
688     gss_eap_attr_ctx::registerProvider(ATTR_TYPE_SAML, createAttrContext);
689     return true;
690 }
691
692 void
693 gss_eap_saml_attr_provider::finalize(void)
694 {
695     gss_eap_attr_ctx::unregisterProvider(ATTR_TYPE_SAML);
696 }
697
698 gss_eap_attr_provider *
699 gss_eap_saml_attr_provider::createAttrContext(void)
700 {
701     return new gss_eap_saml_attr_provider;
702 }
703
704 OM_uint32
705 gssEapSamlAttrProvidersInit(OM_uint32 *minor)
706 {
707     if (!gss_eap_saml_assertion_provider::init() ||
708         !gss_eap_saml_attr_provider::init()) {
709         *minor = GSSEAP_SAML_INIT_FAILURE;
710         return GSS_S_FAILURE;
711     }
712
713     return GSS_S_COMPLETE;
714 }
715
716 OM_uint32
717 gssEapSamlAttrProvidersFinalize(OM_uint32 *minor)
718 {
719     gss_eap_saml_attr_provider::finalize();
720     gss_eap_saml_assertion_provider::finalize();
721
722     *minor = 0;
723     return GSS_S_COMPLETE;
724 }