-/*
- * Copyright 2001-2010 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
*/
/**
}
~NameIDAttributeDecoder() {}
+ // deprecated method
shibsp::Attribute* decode(
const vector<string>& ids, const XMLObject* xmlObject, const char* assertingParty=nullptr, const char* relyingParty=nullptr
+ ) const {
+ return decode(nullptr, ids, xmlObject, assertingParty, relyingParty);
+ }
+
+ shibsp::Attribute* decode(
+ const GenericRequest*, const vector<string>&, const XMLObject*, const char* assertingParty=nullptr, const char* relyingParty=nullptr
) const;
private:
};
shibsp::Attribute* NameIDAttributeDecoder::decode(
- const vector<string>& ids, const XMLObject* xmlObject, const char* assertingParty, const char* relyingParty
+ const GenericRequest*, const vector<string>& ids, const XMLObject* xmlObject, const char* assertingParty, const char* relyingParty
) const
{
auto_ptr<NameIDAttribute> nameid(
- new NameIDAttribute(ids, (!m_formatter.empty()) ? m_formatter.c_str() : DEFAULT_NAMEID_FORMATTER)
+ new NameIDAttribute(ids, (!m_formatter.empty()) ? m_formatter.c_str() : DEFAULT_NAMEID_FORMATTER, m_hashAlg.c_str())
);
vector<NameIDAttribute::Value>& dest = nameid->getValues();
vector<XMLObject*>::const_iterator v,stop;
- Category& log = Category::getInstance(SHIBSP_LOGCAT".AttributeDecoder.NameID");
+ Category& log = Category::getInstance(SHIBSP_LOGCAT ".AttributeDecoder.NameID");
if (xmlObject && XMLString::equals(opensaml::saml1::Attribute::LOCAL_NAME,xmlObject->getElementQName().getLocalPart())) {
const opensaml::saml2::Attribute* saml2attr = dynamic_cast<const opensaml::saml2::Attribute*>(xmlObject);
}
}
- for (; v!=stop; ++v) {
+ for (; v != stop; ++v) {
const NameIDType* n2 = dynamic_cast<const NameIDType*>(*v);
if (n2) {
log.debug("decoding AttributeValue element of saml2:NameIDType type");
}
}
- return dest.empty() ? nullptr : _decode(nameid.release());
+ return dest.empty() ? nullptr : nameid.release();
}
const NameIDType* saml2name = dynamic_cast<const NameIDType*>(xmlObject);
}
}
- return dest.empty() ? nullptr : _decode(nameid.release());
+ return dest.empty() ? nullptr : nameid.release();
}
void NameIDAttributeDecoder::extract(
dest.push_back(NameIDAttribute::Value());
NameIDAttribute::Value& val = dest.back();
val.m_Name = name.get();
- char* str = toUTF8(n->getFormat());
- if (str) {
- val.m_Format = str;
- delete[] str;
- }
- str = toUTF8(n->getNameQualifier());
- if (str && *str)
- val.m_NameQualifier = str;
+ auto_arrayptr<char> format(toUTF8(n->getFormat()));
+ if (format.get())
+ val.m_Format = format.get();
+
+ auto_arrayptr<char> nameQualifier(toUTF8(n->getNameQualifier()));
+ if (nameQualifier.get() && *nameQualifier.get())
+ val.m_NameQualifier = nameQualifier.get();
else if (m_defaultQualifiers && assertingParty)
val.m_NameQualifier = assertingParty;
- delete[] str;
- str = toUTF8(n->getSPNameQualifier());
- if (str && *str)
- val.m_SPNameQualifier = str;
+ auto_arrayptr<char> spNameQualifier(toUTF8(n->getSPNameQualifier()));
+ if (spNameQualifier.get() && *spNameQualifier.get())
+ val.m_SPNameQualifier = spNameQualifier.get();
else if (m_defaultQualifiers && relyingParty)
val.m_SPNameQualifier = relyingParty;
- delete[] str;
- str = toUTF8(n->getSPProvidedID());
- if (str) {
- val.m_SPProvidedID = str;
- delete[] str;
- }
+ auto_arrayptr<char> spProvidedID(toUTF8(n->getSPProvidedID()));
+ if (spProvidedID.get())
+ val.m_SPProvidedID = spProvidedID.get();
}
}
dest.push_back(NameIDAttribute::Value());
NameIDAttribute::Value& val = dest.back();
val.m_Name = name.get();
- char* str = toUTF8(n->getFormat());
- if (str) {
- val.m_Format = str;
- delete[] str;
- }
- str = toUTF8(n->getNameQualifier());
- if (str && *str)
- val.m_NameQualifier = str;
+ auto_arrayptr<char> format(toUTF8(n->getFormat()));
+ if (format.get())
+ val.m_Format = format.get();
+
+ auto_arrayptr<char> nameQualifier(toUTF8(n->getNameQualifier()));
+ if (nameQualifier.get() && *nameQualifier.get())
+ val.m_NameQualifier = nameQualifier.get();
else if (m_defaultQualifiers && assertingParty)
val.m_NameQualifier = assertingParty;
- delete[] str;
if (m_defaultQualifiers && relyingParty)
val.m_SPNameQualifier = relyingParty;