remove debugging statement
[moonshot.git] / mech_eap / util_shib.cpp
index b625540..ab241a7 100644 (file)
@@ -156,9 +156,10 @@ gss_eap_shib_attr_provider::initFromGssContext(const gss_eap_attr_ctx *manager,
 {
     const gss_eap_saml_assertion_provider *saml;
     const gss_eap_radius_attr_provider *radius;
-    //gss_buffer_desc nameBuf = GSS_C_EMPTY_BUFFER;
-    //OM_uint32 minor;
-
+#if 0
+    gss_buffer_desc nameBuf = GSS_C_EMPTY_BUFFER;
+    OM_uint32 minor;
+#endif
     if (!gss_eap_attr_provider::initFromGssContext(manager, gssCred, gssCtx))
         return false;
 
@@ -169,17 +170,19 @@ gss_eap_shib_attr_provider::initFromGssContext(const gss_eap_attr_ctx *manager,
 
     auto_ptr<ShibbolethResolver> resolver(ShibbolethResolver::create());
 
-    // For now, leave ApplicationID defaulted.
-    // Later on, we could allow this via config option to the mechanism
-    // or rely on an SPRequest interface to pass in a URI identifying the
-    // acceptor.
     /*
+     * For now, leave ApplicationID defaulted.
+     * Later on, we could allow this via config option to the mechanism
+     * or rely on an SPRequest interface to pass in a URI identifying the
+     * acceptor.
+     */
+#if 0
     if (gssCred != GSS_C_NO_CREDENTIAL &&
         gssEapDisplayName(&minor, gssCred->name, &nameBuf, NULL) == GSS_S_COMPLETE) {
         resolver->setApplicationID((const char *)nameBuf.value);
         gss_release_buffer(&minor, &nameBuf);
     }
-    */
+#endif
 
     m_authenticated = false;
 
@@ -378,56 +381,39 @@ gss_eap_shib_attr_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UN
     delete v;
 }
 
-void
-gss_eap_shib_attr_provider::exportToBuffer(gss_buffer_t buffer) const
+const char *
+gss_eap_shib_attr_provider::marshallingKey(void) const
 {
-    DDF obj(NULL);
-    DDF attrs(NULL);
+    return "local";
+}
 
-    buffer->length = 0;
-    buffer->value = NULL;
+DDF
+gss_eap_shib_attr_provider::marshall(void) const
+{
+    DDF obj(NULL);
 
-    obj.addmember("version").integer(1);
     obj.addmember("authenticated").integer(m_authenticated);
 
-    attrs = obj.addmember("attributes").list();
+    DDF attrs = obj.addmember("attributes").list();
     for (vector<Attribute*>::const_iterator a = m_attributes.begin();
          a != m_attributes.end(); ++a) {
         DDF attr = (*a)->marshall();
         attrs.add(attr);
     }
 
-    ostringstream sink;
-    sink << attrs;
-    string str = sink.str();
-
-    duplicateBuffer(str, buffer);
-
-    attrs.destroy();
+    return obj;
 }
 
 bool
-gss_eap_shib_attr_provider::initFromBuffer(const gss_eap_attr_ctx *ctx,
-                                           const gss_buffer_t buffer)
+gss_eap_shib_attr_provider::unmarshallAndInit(const gss_eap_attr_ctx *ctx,
+                                              DDF &obj)
 {
-    if (!gss_eap_attr_provider::initFromBuffer(ctx, buffer))
+    if (!gss_eap_attr_provider::unmarshallAndInit(ctx, obj))
         return false;
 
-    if (buffer->length == 0)
-        return true;
-
     assert(m_authenticated == false);
     assert(m_attributes.size() == 0);
 
-    DDF obj(NULL);
-    string str((const char *)buffer->value, buffer->length);
-    istringstream source(str);
-
-    source >> obj;
-
-    if (obj["version"].integer() != 1)
-        return false;
-
     m_authenticated = (obj["authenticated"].integer() != 0);
 
     DDF attrs = obj["attributes"];
@@ -438,8 +424,6 @@ gss_eap_shib_attr_provider::initFromBuffer(const gss_eap_attr_ctx *ctx,
         attr = attrs.next();
     }
 
-    attrs.destroy();
-
     return true;
 }