89 |
int expires) |
int expires) |
90 |
{ |
{ |
91 |
add(h, contents); |
add(h, contents); |
|
h->send(h->accept(200)); |
|
92 |
} |
} |
93 |
|
|
94 |
virtual void onRemoved(ServerPublicationHandle h, const Data& etag, const SipMessage& pub, int expires) |
virtual void onRemoved(ServerPublicationHandle h, const Data& etag, const SipMessage& pub, int expires) |
98 |
private: |
private: |
99 |
void add(ServerPublicationHandle h, const Contents* contents) |
void add(ServerPublicationHandle h, const Contents* contents) |
100 |
{ |
{ |
101 |
|
if (h->getDocumentKey() == h->getPublisher()) |
102 |
|
{ |
103 |
const X509Contents* x509 = dynamic_cast<const X509Contents*>(contents); |
const X509Contents* x509 = dynamic_cast<const X509Contents*>(contents); |
104 |
assert(x509); |
assert(x509); |
105 |
mSecurity.addUserCertDER(h->getPublisher(), x509->getBodyData()); |
mSecurity.addUserCertDER(h->getPublisher(), x509->getBodyData()); |
106 |
|
h->send(h->accept(200)); |
107 |
|
} |
108 |
|
else |
109 |
|
{ |
110 |
|
h->send(h->accept(403)); // !jf! is this the correct code? |
111 |
|
} |
112 |
} |
} |
113 |
|
|
114 |
Security& mSecurity; |
Security& mSecurity; |
153 |
int expires) |
int expires) |
154 |
{ |
{ |
155 |
add(h, contents); |
add(h, contents); |
|
h->send(h->accept(200)); |
|
156 |
} |
} |
157 |
|
|
158 |
virtual void onRemoved(ServerPublicationHandle h, const Data& etag, const SipMessage& pub, int expires) |
virtual void onRemoved(ServerPublicationHandle h, const Data& etag, const SipMessage& pub, int expires) |
163 |
private: |
private: |
164 |
void add(ServerPublicationHandle h, const Contents* contents) |
void add(ServerPublicationHandle h, const Contents* contents) |
165 |
{ |
{ |
166 |
|
if (h->getDocumentKey() == h->getPublisher()) |
167 |
|
{ |
168 |
const Pkcs8Contents* pkcs8 = dynamic_cast<const Pkcs8Contents*>(contents); |
const Pkcs8Contents* pkcs8 = dynamic_cast<const Pkcs8Contents*>(contents); |
169 |
assert(pkcs8); |
assert(pkcs8); |
170 |
mSecurity.addUserPrivateKeyDER(h->getPublisher(), pkcs8->getBodyData()); |
mSecurity.addUserPrivateKeyDER(h->getPublisher(), pkcs8->getBodyData()); |
171 |
} |
} |
172 |
|
else |
173 |
|
{ |
174 |
|
h->send(h->accept(403)); // !jf! is this the correct code? |
175 |
|
} |
176 |
|
} |
177 |
|
|
178 |
Security& mSecurity; |
Security& mSecurity; |
179 |
}; |
}; |
187 |
|
|
188 |
virtual void onNewSubscription(ServerSubscriptionHandle h, const SipMessage& sub) |
virtual void onNewSubscription(ServerSubscriptionHandle h, const SipMessage& sub) |
189 |
{ |
{ |
190 |
|
if (!mSecurity.hasUserCert(h->getDocumentKey())) |
191 |
|
{ |
192 |
|
// !jf! really need to do this async. send neutral state in the meantime, |
193 |
|
// blah blah blah |
194 |
|
mSecurity.generateUserCert(h->getDocumentKey(), Data::Empty); |
195 |
|
} |
196 |
|
|
197 |
if (mSecurity.hasUserCert(h->getDocumentKey())) |
if (mSecurity.hasUserCert(h->getDocumentKey())) |
198 |
{ |
{ |
199 |
X509Contents x509(mSecurity.getUserCertDER(h->getDocumentKey())); |
X509Contents x509(mSecurity.getUserCertDER(h->getDocumentKey())); |
235 |
|
|
236 |
virtual void onNewSubscription(ServerSubscriptionHandle h, const SipMessage& sub) |
virtual void onNewSubscription(ServerSubscriptionHandle h, const SipMessage& sub) |
237 |
{ |
{ |
238 |
if (mSecurity.hasUserCert(h->getDocumentKey())) |
if (h->getDocumentKey() != h->getPublisher()) |
239 |
|
{ |
240 |
|
h->send(h->accept(403)); // !jf! is this the correct code? |
241 |
|
} |
242 |
|
else if (mSecurity.hasUserCert(h->getDocumentKey())) |
243 |
{ |
{ |
244 |
Pkcs8Contents pkcs(mSecurity.getUserPrivateKeyDER(h->getDocumentKey())); |
Pkcs8Contents pkcs(mSecurity.getUserPrivateKeyDER(h->getDocumentKey())); |
245 |
h->send(h->update(&pkcs)); |
h->send(h->update(&pkcs)); |
265 |
virtual void onError(ServerSubscriptionHandle, const SipMessage& msg) |
virtual void onError(ServerSubscriptionHandle, const SipMessage& msg) |
266 |
{ |
{ |
267 |
} |
} |
268 |
|
|
269 |
private: |
private: |
270 |
Security& mSecurity; |
Security& mSecurity; |
271 |
}; |
}; |
284 |
{ |
{ |
285 |
addTransport(UDP, 5100); |
addTransport(UDP, 5100); |
286 |
addTransport(TCP, 5100); |
addTransport(TCP, 5100); |
287 |
|
addTransport(TLS, 5101, |
288 |
// addTlsTransport |
// addTlsTransport |
289 |
|
|
290 |
mProfile.clearSupportedMethods(); |
mProfile.clearSupportedMethods(); |