/*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
DOMDocument *doc;
const XMLObjectBuilder *b;
- doc = XMLToolingConfig::getConfig().getParser().parse(istream);
- if (doc == NULL)
- return NULL;
+ try {
+ doc = XMLToolingConfig::getConfig().getParser().parse(istream);
+ if (doc == NULL)
+ return NULL;
- b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
+ b = XMLObjectBuilder::getBuilder(doc->getDocumentElement());
#ifdef __APPLE__
- return (saml2::Assertion *)((void *)b->buildFromDocument(doc));
+ return (saml2::Assertion *)((void *)b->buildFromDocument(doc));
#else
- return dynamic_cast<saml2::Assertion *>(b->buildFromDocument(doc));
+ return dynamic_cast<saml2::Assertion *>(b->buildFromDocument(doc));
#endif
+ } catch (exception &e) {
+ return NULL;
+ }
}
bool
}
bool
-gss_eap_saml_assertion_provider::setAttribute(int complete,
+gss_eap_saml_assertion_provider::setAttribute(int complete GSSEAP_UNUSED,
const gss_buffer_t attr,
const gss_buffer_t value)
{
}
bool
-gss_eap_saml_assertion_provider::deleteAttribute(const gss_buffer_t value)
+gss_eap_saml_assertion_provider::deleteAttribute(const gss_buffer_t value GSSEAP_UNUSED)
{
delete m_assertion;
m_assertion = NULL;
int *authenticated,
int *complete,
gss_buffer_t value,
- gss_buffer_t display_value,
+ gss_buffer_t display_value GSSEAP_UNUSED,
int *more) const
{
string str;
gss_any_t
gss_eap_saml_assertion_provider::mapToAny(int authenticated,
- gss_buffer_t type_id) const
+ gss_buffer_t type_id GSSEAP_UNUSED) const
{
if (authenticated && !m_authenticated)
return (gss_any_t)NULL;
}
void
-gss_eap_saml_assertion_provider::releaseAnyNameMapping(gss_buffer_t type_id,
+gss_eap_saml_assertion_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UNUSED,
gss_any_t input) const
{
delete ((saml2::Assertion *)input);
{
gss_eap_attr_ctx::registerProvider(ATTR_TYPE_SAML_ASSERTION,
"urn:ietf:params:gss-eap:saml-aaa-assertion",
- gss_eap_saml_assertion_provider::createAttrContext);
+ createAttrContext);
return true;
}
const_cast<const saml2::AttributeStatement*>(*s)->getAttributes();
for (vector<saml2::Attribute*>::const_iterator a = attrs.begin(); a != attrs.end(); ++a) {
- const XMLCh *attributeName = (*a)->getName();
- const XMLCh *attributeNameFormat = (*a)->getNameFormat();
+ const XMLCh *attributeName, *attributeNameFormat;
XMLCh *qualifiedName;
XMLCh space[2] = { ' ', 0 };
gss_buffer_desc utf8;
bool ret;
+ attributeName = (*a)->getName();
+ attributeNameFormat = (*a)->getNameFormat();
+ if (attributeNameFormat == NULL || attributeNameFormat[0] == '\0')
+ attributeNameFormat = saml2::Attribute::UNSPECIFIED;
+
qualifiedName = new XMLCh[XMLString::stringLen(attributeNameFormat) + 1 +
XMLString::stringLen(attributeName) + 1];
XMLString::copyString(qualifiedName, attributeNameFormat);
static BaseRefVectorOf<XMLCh> *
decomposeAttributeName(const gss_buffer_t attr)
{
- XMLCh *qualifiedAttr = new XMLCh[attr->length + 1];
- XMLString::transcode((const char *)attr->value, qualifiedAttr, attr->length);
+ string inputAttr((const char *) attr->value, attr->length);
+ XMLCh *qualifiedAttr = XMLString::transcode((const char *)inputAttr.c_str());
BaseRefVectorOf<XMLCh> *components = XMLString::tokenizeString(qualifiedAttr);
- delete qualifiedAttr;
+ XMLString::release(&qualifiedAttr);
if (components->size() != 2) {
delete components;
}
bool
-gss_eap_saml_attr_provider::setAttribute(int complete,
+gss_eap_saml_attr_provider::setAttribute(int complete GSSEAP_UNUSED,
const gss_buffer_t attr,
const gss_buffer_t value)
{
attribute->setNameFormat(components->elementAt(0));
attribute->setName(components->elementAt(1));
- XMLCh *xmlValue = new XMLCh[value->length + 1];
- XMLString::transcode((const char *)value->value, xmlValue, attr->length);
+ string sValue((const char *) value->value, value->length);
+ XMLCh *xmlValue = XMLString::transcode(sValue.c_str());
attributeValue = saml2::AttributeValueBuilder::buildAttributeValue();
attributeValue->setTextContent(xmlValue);
attributeStatement->getAttributes().push_back(attribute);
delete components;
- delete xmlValue;
+ XMLString::release(&xmlValue);;
return true;
}
const_cast<const saml2::AttributeStatement*>(*s)->getAttributes();
for (vector<saml2::Attribute *>::const_iterator a = attrs.begin(); a != attrs.end(); ++a) {
- if (XMLString::equals((*a)->getNameFormat(), components->elementAt(0)) &&
- XMLString::equals((*a)->getName(), components->elementAt(1))) {
+ const XMLCh *attributeName, *attributeNameFormat;
+
+ attributeName = (*a)->getName();
+ attributeNameFormat = (*a)->getNameFormat();
+ if (attributeNameFormat == NULL || attributeNameFormat[0] == '\0')
+ attributeNameFormat = saml2::Attribute::UNSPECIFIED;
+
+ if (XMLString::equals(attributeNameFormat, components->elementAt(0)) &&
+ XMLString::equals(attributeName, components->elementAt(1))) {
ret = *a;
break;
}
}
gss_any_t
-gss_eap_saml_attr_provider::mapToAny(int authenticated,
- gss_buffer_t type_id) const
+gss_eap_saml_attr_provider::mapToAny(int authenticated GSSEAP_UNUSED,
+ gss_buffer_t type_id GSSEAP_UNUSED) const
{
return (gss_any_t)NULL;
}
void
-gss_eap_saml_attr_provider::releaseAnyNameMapping(gss_buffer_t type_id,
- gss_any_t input) const
+gss_eap_saml_attr_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UNUSED,
+ gss_any_t input GSSEAP_UNUSED) const
{
}
{
gss_eap_attr_ctx::registerProvider(ATTR_TYPE_SAML,
"urn:ietf:params:gss-eap:saml-attr",
- gss_eap_saml_attr_provider::createAttrContext);
+ createAttrContext);
return true;
}
{
gss_eap_saml_attr_provider::finalize();
gss_eap_saml_assertion_provider::finalize();
+
+ *minor = 0;
return GSS_S_COMPLETE;
}