diff -r 000000000000 -r 62f9d29f7211 webservices/wsdescription/src/sencredential.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webservices/wsdescription/src/sencredential.cpp Thu Jan 07 16:19:19 2010 +0200 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + + + + +// INCLUDE FILES +#include "SenCredential.h" + +//#include "SenDebug.h" + +#include + +#include +#include + + +#ifdef SYMBIAN_SECURE_ECOM + // for S60 FP3 (2.8) platform or newer (3.0 and above) + #include // needed for RAttributeArray +//#else // for S60 FP2 platform (2.6) or older + //#include "Attribute.h" +#endif + +using namespace Xml; + +namespace +{ + /* milliseconds before actual notOnOrAfter time + * when credentials are treated + * as expired. + */ + + // Identifiers which are accepted (and searched after) + _LIT8(KId, "ID"); + _LIT8(Kwsu_ns_plus_Id, "wsu:Id"); + _LIT8(KAssertionId, "AssertionID"); + + _LIT8(KConditions, "Conditions"); + _LIT8(KVal_NotOnOrAfter, "NotOnOrAfter"); +} + +EXPORT_C CSenCredential* CSenCredential::NewL( + const TDesC8& aNsUri, + const TDesC8& aLocalName, + const TDesC8& aQName, + const RAttributeArray& aAttributes + ) + { + CSenCredential* pNew = NewLC(aNsUri, aLocalName, aQName, aAttributes); + CleanupStack::Pop(); // pNew; + return pNew; + } + +EXPORT_C CSenCredential* CSenCredential::NewLC( + const TDesC8& aNsUri, + const TDesC8& aLocalName, + const TDesC8& aQName, + const RAttributeArray& aAttributes + ) + { + CSenCredential* pNew = new (ELeave) CSenCredential; + CleanupStack::PushL(pNew); + pNew->ConstructL(aNsUri, aLocalName, aQName, aAttributes); + return pNew; + } + +EXPORT_C CSenCredential* CSenCredential::NewL( + const TDesC8& aNsUri, + const TDesC8& aLocalName, + const TDesC8& aQName, + const RAttributeArray& aAttributes, + CSenElement& aParent + ) + { + CSenCredential* pNew = NewLC(aNsUri, aLocalName, + aQName, aAttributes, aParent); + CleanupStack::Pop(); // pNew; + return pNew; + } + +EXPORT_C CSenCredential* CSenCredential::NewLC( + const TDesC8& aNsUri, + const TDesC8& aLocalName, + const TDesC8& aQName, + const RAttributeArray& aAttributes, + CSenElement& aParent + ) + { + CSenCredential* pNew = new (ELeave) CSenCredential; + CleanupStack::PushL(pNew); + pNew->ConstructL(aNsUri, aLocalName, aQName, aAttributes, aParent); + return pNew; + } + + +EXPORT_C CSenCredential* CSenCredential::NewL( + const CSenCredential& aCredential) + { + CSenCredential* pNew = NewLC(aCredential); + CleanupStack::Pop(); // pNew; + return pNew; + } + +EXPORT_C CSenCredential* CSenCredential::NewLC( + const CSenCredential& aCredential) + { + CSenCredential* pNew = new (ELeave) CSenCredential; + CleanupStack::PushL(pNew); + pNew->ConstructL((CSenCredential&)aCredential); + return pNew; + } + + +EXPORT_C void CSenCredential::ConstructL(CSenCredential& aCredential) + { + ipElement = CSenXmlElement::NewL(aCredential.ipElement->LocalName()); + ipElement->CopyFromL(*(CSenXmlElement*)(aCredential.ipElement)); + if (aCredential.ValidUntil() != Time::NullTTime()) + { + SetValidUntil(aCredential.ValidUntil()); + } + SetIdL(aCredential.Id()); + } + +EXPORT_C void CSenCredential::ConstructL( + const TDesC8& aNsUri, + const TDesC8& aLocalName, + const TDesC8& aQName, + const RAttributeArray& aAttributes, + CSenElement& aParent + ) + { + BaseConstructL(aNsUri, aLocalName, aQName, aAttributes, aParent); + // this ensures we take note of possible namespaces and + // prefixed attributes + CSenBaseFragment::SetAttributesL(aAttributes); + // we want to save its ID and validity + + TPtrC8 identifier = SenXmlUtils::AttrValue(aAttributes, KId); + if(identifier.Length()>0) + { + SetIdL(identifier); + } + + TPtrC8 identifier2 = SenXmlUtils::AttrValue(aAttributes, Kwsu_ns_plus_Id); + if(identifier2.Length()>0) + { + SetIdL(identifier2); + } + + TPtrC8 identifier3 = SenXmlUtils::AttrValue(aAttributes, KAssertionId); + if(identifier3.Length()>0) + { + SetIdL(identifier3); + } + + /* + + for(int i=0; i0) + { + SetIdL(identifier); + } + + TPtrC8 identifier2 = SenXmlUtils::AttrValue(aAttributes, Kwsu_ns_plus_Id); + if(identifier2.Length()>0) + { + SetIdL(identifier2); + } + + TPtrC8 identifier3 = SenXmlUtils::AttrValue(aAttributes, KAssertionId); + if(identifier3.Length()>0) + { + SetIdL(identifier3); + } + /* + // we want to save its ID and validity + for(int i=0; i 0) + { + iNotOnOrAfter = SenDateUtils::FromXmlDateTimeL(ptr); + } + } + CSenBaseFragment::StartElementL(aNsUri, + aLocalName, aQName, aAttributes); + } + +EXPORT_C TTime& CSenCredential::ValidUntil() + { + return iNotOnOrAfter; + } + + +EXPORT_C void CSenCredential::SetValidUntil(TTime& aTime) + { + iNotOnOrAfter = aTime; + } + + +// END OF FILE +