|
reSIProcate/repro
9694
|
00001 #include "resip/stack/ssl/Security.hxx" 00002 #include "resip/stack/X509Contents.hxx" 00003 #include "resip/dum/ServerPublication.hxx" 00004 #include "repro/stateAgents/CertPublicationHandler.hxx" 00005 00006 using namespace repro; 00007 using namespace resip; 00008 00009 CertPublicationHandler::CertPublicationHandler(Security& security) : mSecurity(security) 00010 { 00011 } 00012 00013 void 00014 CertPublicationHandler::onInitial(ServerPublicationHandle h, 00015 const Data& etag, 00016 const SipMessage& pub, 00017 const Contents* contents, 00018 const SecurityAttributes* attrs, 00019 UInt32 expires) 00020 { 00021 add(h, contents); 00022 } 00023 00024 void 00025 CertPublicationHandler::onExpired(ServerPublicationHandle h, const Data& etag) 00026 { 00027 mSecurity.removeUserCert(h->getPublisher()); 00028 } 00029 00030 void 00031 CertPublicationHandler::onRefresh(ServerPublicationHandle, 00032 const Data& etag, 00033 const SipMessage& pub, 00034 const Contents* contents, 00035 const SecurityAttributes* attrs, 00036 UInt32 expires) 00037 { 00038 } 00039 00040 void 00041 CertPublicationHandler::onUpdate(ServerPublicationHandle h, 00042 const Data& etag, 00043 const SipMessage& pub, 00044 const Contents* contents, 00045 const SecurityAttributes* attrs, 00046 UInt32 expires) 00047 { 00048 add(h, contents); 00049 } 00050 00051 void 00052 CertPublicationHandler::onRemoved(ServerPublicationHandle h, const Data& etag, const SipMessage& pub, UInt32 expires) 00053 { 00054 mSecurity.removeUserCert(h->getPublisher()); 00055 } 00056 00057 void 00058 CertPublicationHandler::add(ServerPublicationHandle h, const Contents* contents) 00059 { 00060 if (h->getDocumentKey() == h->getPublisher()) 00061 { 00062 const X509Contents* x509 = dynamic_cast<const X509Contents*>(contents); 00063 assert(x509); 00064 mSecurity.addUserCertDER(h->getPublisher(), x509->getBodyData()); 00065 h->send(h->accept(200)); 00066 } 00067 else 00068 { 00069 h->send(h->accept(403)); // !jf! is this the correct code? 00070 } 00071 } 00072
1.7.5.1