X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2Fimpl%2FDynamicMetadataProvider.cpp;h=9a65d012af68b11bc9306d181dffb8e7057a007b;hb=d76fadfe73c89442f328a7540e7b0ae08e0fbae6;hp=4bf36565df636be6eb42b76d592b1dcfd7c9527f;hpb=16d5976c9821b70d95675983702e0032d8769467;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp b/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp index 4bf3656..9a65d01 100644 --- a/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp @@ -1,17 +1,21 @@ -/* - * 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. */ /** @@ -43,6 +47,7 @@ using namespace std; # define min(a,b) (((a) < (b)) ? (a) : (b)) # endif +static const XMLCh id[] = UNICODE_LITERAL_2(i,d); static const XMLCh maxCacheDuration[] = UNICODE_LITERAL_16(m,a,x,C,a,c,h,e,D,u,r,a,t,i,o,n); static const XMLCh minCacheDuration[] = UNICODE_LITERAL_16(m,i,n,C,a,c,h,e,D,u,r,a,t,i,o,n); static const XMLCh refreshDelayFactor[] = UNICODE_LITERAL_18(r,e,f,r,e,s,h,D,e,l,a,y,F,a,c,t,o,r); @@ -59,11 +64,12 @@ namespace opensaml { DynamicMetadataProvider::DynamicMetadataProvider(const DOMElement* e) : AbstractMetadataProvider(e), - m_maxCacheDuration(XMLHelper::getAttrInt(e, 28800, maxCacheDuration)), + m_validate(XMLHelper::getAttrBool(e, false, validate)), + m_id(XMLHelper::getAttrString(e, "Dynamic", id)), m_lock(RWLock::create()), m_refreshDelayFactor(0.75), m_minCacheDuration(XMLHelper::getAttrInt(e, 600, minCacheDuration)), - m_validate(XMLHelper::getAttrBool(e, false, validate)) + m_maxCacheDuration(XMLHelper::getAttrInt(e, 28800, maxCacheDuration)) { if (m_minCacheDuration > m_maxCacheDuration) { Category::getInstance(SAML_LOGCAT".MetadataProvider.Dynamic").error( @@ -112,6 +118,11 @@ void DynamicMetadataProvider::init() { } +const char* DynamicMetadataProvider::getId() const +{ + return m_id.c_str(); +} + pair DynamicMetadataProvider::getEntityDescriptor(const Criteria& criteria) const { Category& log = Category::getInstance(SAML_LOGCAT".MetadataProvider.Dynamic"); @@ -231,6 +242,8 @@ pair DynamicMetadataProvider::get cacheExp = SAMLTIME_MAX; indexEntity(entity2.release(), cacheExp, true); + m_lastUpdate = now; + // Downgrade back to a read lock. m_lock->unlock(); m_lock->rdlock();