[cpp-sp COMMIT] in /branches/REL_2/shibsp: attribute/Attribute.cpp attribute/AttributeDecoder.h attribute/Base64Attri...
noreply at shibboleth.net
noreply at shibboleth.net
Thu Mar 29 22:18:21 BST 2012
Author: scantor
Date: Thu Mar 29 22:18:21 2012
New Revision: 3603
URL: http://svn.shibboleth.net/view/cpp-sp?rev=3603&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-390
Modified:
branches/REL_2/shibsp/attribute/Attribute.cpp
branches/REL_2/shibsp/attribute/AttributeDecoder.h
branches/REL_2/shibsp/attribute/Base64AttributeDecoder.cpp
branches/REL_2/shibsp/attribute/DOMAttributeDecoder.cpp
branches/REL_2/shibsp/attribute/KeyInfoAttributeDecoder.cpp
branches/REL_2/shibsp/attribute/NameIDAttributeDecoder.cpp
branches/REL_2/shibsp/attribute/NameIDFromScopedAttributeDecoder.cpp
branches/REL_2/shibsp/attribute/ScopedAttributeDecoder.cpp
branches/REL_2/shibsp/attribute/StringAttributeDecoder.cpp
branches/REL_2/shibsp/attribute/XMLAttributeDecoder.cpp
branches/REL_2/shibsp/attribute/resolver/AttributeResolver.h
branches/REL_2/shibsp/attribute/resolver/impl/ChainingAttributeResolver.cpp
branches/REL_2/shibsp/attribute/resolver/impl/QueryAttributeResolver.cpp
branches/REL_2/shibsp/attribute/resolver/impl/SimpleAggregationAttributeResolver.cpp
branches/REL_2/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp
branches/REL_2/shibsp/handler/impl/AssertionConsumerService.cpp
Modified: branches/REL_2/shibsp/attribute/Attribute.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/attribute/Attribute.cpp?rev=3603&r1=3602&r2=3603&view=diff
==============================================================================
--- branches/REL_2/shibsp/attribute/Attribute.cpp (original)
+++ branches/REL_2/shibsp/attribute/Attribute.cpp Thu Mar 29 22:18:21 2012
@@ -33,9 +33,10 @@
#endif
#include "util/SPConstants.h"
-#include <xercesc/util/XMLUniDefs.hpp>
+#include <xmltooling/XMLObject.h>
#include <xmltooling/security/SecurityHelper.h>
#include <xmltooling/util/XMLHelper.h>
+#include <xercesc/util/XMLUniDefs.hpp>
using namespace shibsp;
using namespace xmltooling;
@@ -72,9 +73,10 @@
chLatin_D, chLatin_e, chLatin_c, chLatin_o, chLatin_d, chLatin_e, chLatin_r, chNull
};
- static const XMLCh caseSensitive[] = UNICODE_LITERAL_13(c,a,s,e,S,e,n,s,i,t,i,v,e);
- static const XMLCh hashAlg[] = UNICODE_LITERAL_7(h,a,s,h,A,l,g);
- static const XMLCh internal[] = UNICODE_LITERAL_8(i,n,t,e,r,n,a,l);
+ static const XMLCh caseSensitive[] = UNICODE_LITERAL_13(c,a,s,e,S,e,n,s,i,t,i,v,e);
+ static const XMLCh hashAlg[] = UNICODE_LITERAL_7(h,a,s,h,A,l,g);
+ static const XMLCh internal[] = UNICODE_LITERAL_8(i,n,t,e,r,n,a,l);
+ static const XMLCh langAware[] = UNICODE_LITERAL_9(l,a,n,g,A,w,a,r,e);
#endif
};
@@ -104,12 +106,36 @@
AttributeDecoder::AttributeDecoder(const DOMElement *e)
: m_caseSensitive(XMLHelper::getAttrBool(e, true, caseSensitive)),
m_internal(XMLHelper::getAttrBool(e, false, internal)),
+ m_langAware(XMLHelper::getAttrBool(e, false, langAware)),
m_hashAlg(XMLHelper::getAttrString(e, nullptr, hashAlg))
{
}
AttributeDecoder::~AttributeDecoder()
{
+}
+
+Attribute* AttributeDecoder::decode(
+ const GenericRequest* request,
+ const std::vector<std::string>& ids,
+ const xmltooling::XMLObject* xmlObject,
+ const char* assertingParty,
+ const char* relyingParty
+ ) const
+{
+ // Default call into deprecated method.
+ return decode(ids, xmlObject, assertingParty, relyingParty);
+}
+
+Attribute* AttributeDecoder::decode(
+ const std::vector<std::string>& ids,
+ const xmltooling::XMLObject* xmlObject,
+ const char* assertingParty,
+ const char* relyingParty
+ ) const
+{
+ // Default for deprecated method.
+ return nullptr;
}
Attribute* AttributeDecoder::_decode(Attribute* attr) const
@@ -137,6 +163,25 @@
}
return attr;
}
+
+pair<vector<XMLObject*>::const_iterator,vector<XMLObject*>::const_iterator> AttributeDecoder::valueRange(
+ const GenericRequest* request, const vector<XMLObject*>& objects
+ ) const
+{
+ if (!m_langAware || !request)
+ return make_pair(objects.begin(), objects.end());
+ else if (request && request->startLangMatching()) {
+ do {
+ for (vector<XMLObject*>::const_iterator i = objects.begin(); i != objects.end(); ++i) {
+ if (request->matchLang((*i)->getLang())) {
+ return make_pair(i, i + 1);
+ }
+ }
+ } while (request->continueLangMatching());
+ }
+
+ return make_pair(objects.begin(), objects.end());
+}
#endif
void shibsp::registerAttributeFactories()
Modified: branches/REL_2/shibsp/attribute/AttributeDecoder.h
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/attribute/AttributeDecoder.h?rev=3603&r1=3602&r2=3603&view=diff
==============================================================================
--- branches/REL_2/shibsp/attribute/AttributeDecoder.h (original)
+++ branches/REL_2/shibsp/attribute/AttributeDecoder.h Thu Mar 29 22:18:21 2012
@@ -33,6 +33,7 @@
#include <vector>
namespace xmltooling {
[... 1334 lines stripped ...]
More information about the commits
mailing list