// If the platform-name is specified refuse the request: JICPServer does not accept this kind of mediator creation request
String pn = p.getProperty(Profile.PLATFORM_ID);
if (pn != null) {
myLogger.log(Logger.WARNING, "CREATE_MEDIATOR request with specified platform-name: "+pn);
reply = new JICPPacket(JICPProtocol.NOT_AUTHORIZED_ERROR, new JADESecurityException("Platform-name specified"));
break;
}
// If there is a PDPContextManager add the PDP context properties
if (myPDPContextManager != null) {
try{
//FIXME: Get username and password specified among the CREATE_MEDIATOR properties
Properties pdpContextInfo = myPDPContextManager.getPDPContextInfo(addr, p.getProperty(Profile.OWNER));
myLogger.log(Logger.FINE, "PDPContext properties = "+pdpContextInfo);
mergeProperties(p, pdpContextInfo);
}catch(JADESecurityException jse){
if(myLogger.isLoggable(Logger.WARNING))
myLogger.log(Logger.WARNING,"CREATE_MEDIATOR request from non authorized address: "+addr);
reply = new JICPPacket(JICPProtocol.NOT_AUTHORIZED_ERROR, jse);
break;
}
}
// Get mediator ID from the passed properties (if present)
String id = p.getProperty(JICPProtocol.MEDIATOR_ID_KEY);
String msisdn = p.getProperty(PDPContextManager.MSISDN);
if(id != null) {
if (msisdn != null && !msisdn.equals(id)) {
// Security attack: Someone is pretending to be someone other
if(myLogger.isLoggable(Logger.WARNING))
myLogger.log(Logger.WARNING,"CREATE_MEDIATOR request with mediator-id != MSISDN. Address is: "+addr);
reply = new JICPPacket(JICPProtocol.NOT_AUTHORIZED_ERROR, new JADESecurityException("Inconsistent mediator-id and msisdn"));
break;
}
// An existing front-end whose back-end was lost. The BackEnd must resynch
p.setProperty(jade.core.BackEndContainer.RESYNCH, "true");
}