X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fsecurity%2Fimpl%2FChainingCredentialResolver.cpp;h=8f6852c3a9181f6b3cc61e1d57802f243bb9502f;hb=221860019da7b734e81171e4167f8f5c0d03285d;hp=f98ec7cfeaef470f2a7e5e4eccefe450d9dfa1d8;hpb=7f15a5c36be5c748d7610076f76a10c5ba1271f0;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/security/impl/ChainingCredentialResolver.cpp b/xmltooling/security/impl/ChainingCredentialResolver.cpp index f98ec7c..8f6852c 100644 --- a/xmltooling/security/impl/ChainingCredentialResolver.cpp +++ b/xmltooling/security/impl/ChainingCredentialResolver.cpp @@ -1,17 +1,21 @@ -/* - * Copyright 2001-2007 Internet2 - * - * 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 +/** + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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 * - * 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. + * 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. */ /** @@ -27,12 +31,16 @@ #include "util/NDC.h" #include "util/XMLHelper.h" +#include +#include #include using namespace xmltooling::logging; using namespace xmltooling; using namespace std; +using xercesc::DOMElement; + namespace xmltooling { class XMLTOOL_DLLLOCAL ChainingCredentialResolver : public CredentialResolver { @@ -50,15 +58,15 @@ namespace xmltooling { for_each(m_resolvers.begin(), m_resolvers.end(), mem_fun(&Lockable::unlock)); } - const Credential* resolve(const CredentialCriteria* criteria=NULL) const { - const Credential* cred = NULL; + const Credential* resolve(const CredentialCriteria* criteria=nullptr) const { + const Credential* cred = nullptr; for (vector::const_iterator cr = m_resolvers.begin(); !cred && cr!=m_resolvers.end(); ++cr) cred = (*cr)->resolve(criteria); return cred; } virtual vector::size_type resolve( - vector& results, const CredentialCriteria* criteria=NULL + vector& results, const CredentialCriteria* criteria=nullptr ) const { for (vector::const_iterator cr = m_resolvers.begin(); cr!=m_resolvers.end(); ++cr) (*cr)->resolve(results, criteria); @@ -75,7 +83,7 @@ namespace xmltooling { } static const XMLCh _CredentialResolver[] = UNICODE_LITERAL_18(C,r,e,d,e,n,t,i,a,l,R,e,s,o,l,v,e,r); - static const XMLCh _type[] = UNICODE_LITERAL_4(t,y,p,e); + static const XMLCh type[] = UNICODE_LITERAL_4(t,y,p,e); }; ChainingCredentialResolver::ChainingCredentialResolver(const DOMElement* e) @@ -84,13 +92,13 @@ ChainingCredentialResolver::ChainingCredentialResolver(const DOMElement* e) Category& log=Category::getInstance(XMLTOOLING_LOGCAT".CredentialResolver."CHAINING_CREDENTIAL_RESOLVER); // Load up the chain of resolvers. - e = e ? XMLHelper::getFirstChildElement(e, _CredentialResolver) : NULL; + e = e ? XMLHelper::getFirstChildElement(e, _CredentialResolver) : nullptr; while (e) { - auto_ptr_char type(e->getAttributeNS(NULL,_type)); - if (type.get() && *(type.get())) { - log.info("building CredentialResolver of type %s", type.get()); + string t = XMLHelper::getAttrString(e, nullptr, type); + if (!t.empty()) { + log.info("building CredentialResolver of type %s", t.c_str()); try { - m_resolvers.push_back(conf.CredentialResolverManager.newPlugin(type.get(),e)); + m_resolvers.push_back(conf.CredentialResolverManager.newPlugin(t.c_str(), e)); } catch (exception& ex) { log.error("caught exception processing embedded CredentialResolver element: %s", ex.what());