https://issues.shibboleth.net/jira/browse/CPPOST-28
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / MetadataCredentialCriteria.h
index 7f8d77b..5d3a1c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2009 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ namespace opensaml {
         class SAML_API MetadataCredentialCriteria : public xmltooling::CredentialCriteria
         {
         public:
-            /*
+            /**
              * Constructor.
              *
              * @param role      source of metadata-supplied credentials
@@ -60,14 +60,14 @@ namespace opensaml {
                 return m_role;
             }
 
-            bool matches(xmltooling::Credential& credential) const {
+            bool matches(const xmltooling::Credential& credential) const {
                 const MetadataCredentialContext* context = dynamic_cast<const MetadataCredentialContext*>(credential.getCredentalContext());
                 if (context) {
                     // Check for a usage mismatch.
-                    if ((getUsage()==CredentialCriteria::SIGNING_CREDENTIAL || getUsage()==CredentialCriteria::TLS_CREDENTIAL) &&
+                    if ((getUsage() & (xmltooling::Credential::SIGNING_CREDENTIAL | xmltooling::Credential::TLS_CREDENTIAL)) &&
                             XMLString::equals(context->getKeyDescriptor().getUse(),KeyDescriptor::KEYTYPE_ENCRYPTION))
                         return false;
-                    else if (getUsage()==CredentialCriteria::ENCRYPTION_CREDENTIAL &&
+                    else if ((getUsage() & xmltooling::Credential::ENCRYPTION_CREDENTIAL) &&
                             XMLString::equals(context->getKeyDescriptor().getUse(),KeyDescriptor::KEYTYPE_SIGNING))
                         return false;
                 }