-#ifdef SHIBRESOLVER_HAVE_GSSAPI_NAMINGEXTS
-void ShibbolethResolver::addToken(gss_name_t name)
-{
- if (m_gsswrapper) {
- delete m_gsswrapper;
- m_gsswrapper = NULL;
- }
-
- OM_uint32 major, minor;
- gss_buffer_desc namebuf = GSS_C_EMPTY_BUFFER;
-
- major = gss_export_name_composite(&minor, name, &namebuf);
- if (major == GSS_S_COMPLETE) {
- xsecsize_t len=0;
- XMLByte* out=Base64::encode(reinterpret_cast<const XMLByte*>(namebuf.value), namebuf.length, &len);
- if (out) {
- string s;
- s.append(reinterpret_cast<char*>(out), len);
- auto_ptr_XMLCh temp(s.c_str());
- #ifdef SHIBSP_XERCESC_HAS_XMLBYTE_RELEASE
- XMLString::release(&out);
- #else
- XMLString::release((char**)&out);
- #endif
- static const XMLCh _GSSAPI[] = UNICODE_LITERAL_10(G,S,S,A,P,I,N,a,m,e);
- m_gsswrapper = new AnyElementImpl(shibspconstants::SHIB2ATTRIBUTEMAP_NS, _GSSAPI);
- m_gsswrapper->setTextContent(temp.get());
- }
- else {
- Category::getInstance(SHIBRESOLVER_LOGCAT).error("error while base64-encoding GSS name");
- }
- gss_release_buffer(&minor, &namebuf);
- }
- else {
- Category::getInstance(SHIBRESOLVER_LOGCAT).error("error exporting GSS name");
- }
-}
-#endif