Package jade.security

Examples of jade.security.JADESecurityException


              // 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");
              }
View Full Code Here


    if (maliciousAddresses.contains(address)) {
      try {
        sc.close();
      } catch (Exception e) {
      }
      throw new JADESecurityException(address.toString());
    }
  }
View Full Code Here

            // If the platform-name is specified check if it is consistent
            String pn = p.getProperty(Profile.PLATFORM_ID);
            if (pn != null && !pn.equals(platformName)) {
              myLogger.log(Logger.WARNING, myLogPrefix + "Security attack! CREATE_MEDIATOR request with wrong platform name: " + pn);
              reply = new JICPPacket(JICPProtocol.NOT_AUTHORIZED_ERROR, new JADESecurityException("Wrong platform-name"));
              break;
            }

            p.setProperty(BEManagementHelper.FRONT_END_HOST, address.getHostAddress());

            String owner = p.getProperty(Profile.OWNER);
            myLogger.log(Logger.CONFIG, myLogPrefix + "Owner = " + owner);
            try {
              Properties pdpContextInfo = myPDPContextManager.getPDPContextInfo(address, owner);
              mergeProperties(p, pdpContextInfo);
            } catch (JADESecurityException jse) {
              myLogger.log(Logger.WARNING, myLogPrefix + "Security attack! CREATE_MEDIATOR request from non authorized address: " + address);
              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 else
                myLogger.log(Logger.WARNING, myLogPrefix + "Security attack! CREATE_MEDIATOR request with mediator-id != MSISDN. Address is: " + address);
                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");
            } else {
View Full Code Here

            myLogger.log(Logger.WARNING, myLogPrefix + "Address " + addr + " owner " + owner + " not authenticated.");
            throw ((JADESecurityException) ret);
          } else if (ret instanceof Throwable) {
            // Unexpected exception
            myLogger.log(Logger.WARNING, myLogPrefix + "Error retrieving PDPContextPropert for address " + addr + " owner " + owner, (Throwable) ret);
            throw new JADESecurityException(((Throwable) ret).getMessage());
          }
        }

        // If we get here, no installed service is able to retrieve
        // the PDPContext properties --> Let all through with
View Full Code Here

      Command result = theDispatcher.dispatchCommand(remoteTAs, cmd);
     
      // Check whether an exception occurred in the remote container
      switch (checkResult(result, new String[] {AUTH_EXCEPTION, SERVICE_EXCEPTION})) {
      case 1:
        throw new JADESecurityException((String) result.getParamAt(1));
      case 2:
        throw new ServiceException((String) result.getParamAt(1));
      }
     
      return (String)result.getParamAt(0);
View Full Code Here

    // The BORN_AGENT command must not be postponed
    Command r = executeRemotely(c, 0);
    if (r.getCode() == Command.ERROR) {
      // One of the expected exceptions occurred in the remote BackEnd
      // --> It must be an JADESecurityException --> throw it
      throw new JADESecurityException((String) r.getParamAt(2));
    }
    if (r.getParamCnt() > 0) {
      return (String) r.getParamAt(0);
    }
    else {
View Full Code Here

TOP

Related Classes of jade.security.JADESecurityException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.