static public Message Dispatch(Message message)
        {
            // can't authenticate user if he is creating an account / login
            if (message.operationName != "serviceRegister" &&
                message.operationName != "serviceLogin" &&
                message.operationName != "serviceJEEResponse")
            {
                var authorisationStatus = BusinessAccessLayer.CheckAuthorisation(message);
                if (!authorisationStatus.Item1)
                {
                    logger.Info("Denied service access : " + authorisationStatus.Item2);
                    return(new Message
                    {
                        info = "You don't have access to this service : " + authorisationStatus.Item2,
                        operationStatus = false
                    });
                }
            }

            IWorkflowOrchestrator workflowOrchestrator;

            switch (message.operationName)
            {
            case "serviceRegister":
                workflowOrchestrator = new WORegister();
                break;

            case "serviceLogin":
                workflowOrchestrator = new WOLogin();
                break;

            case "serviceLogout":
                workflowOrchestrator = new WOLogout();
                break;

            case "serviceDecrypt":
                workflowOrchestrator = new WODecrypt();
                break;

            case "serviceJEEResponse":
                workflowOrchestrator = new WOJEEResponse();
                break;

            default:
                logger.Error("Workflow orchestrator not found : \"" + message.operationName + "\"");
                throw new Exception("WorkflowOrchestrator \"" + message.operationName + "\" does not exists");
            }

            logger.Info("Authorized service access to user : \"" + message.data[0] + "\", requested service service : \"" + message.operationName + "\"");
            return(workflowOrchestrator.Execute(message));
        }
Ejemplo n.º 2
0
 /*
  * Input Data Layout :
  *      - data[0] : documentName (string)
  *      - data[1] : key (string)
  *      - data[2] : guuid (string)
  *      - data[3] : secret (string)
  *      - data[4] : confidence (float)
  *
  * Output Data Layout :
  */
 public Message ExecuteService(Message message)
 {
     return(BusinessAccessLayer.Dispatch(message));
 }