public static function getProperties() { if (self::$properties == null) { self::$properties = array(); } return self::$properties; }
public function __construct() { $this->classMappingsConfig = new ClassMappingsHandler(); $config = ThreadContext::getORBConfig(); $this->classMappingsConfig = $config->getConfig("weborb/classMappings"); $this->xmlNode = $this->classMappingsConfig->getConfigNode(); }
public function __construct() { $this->servicesConfig = new ServicesConfigHandler(); $config = ThreadContext::getORBConfig(); $this->servicesConfig = $config->getConfig("weborb/services"); $this->xmlNode = $this->servicesConfig->getConfigNode(); }
public function __construct() { $orbConfig = ThreadContext::getORBConfig(); $this->orbSecurity = $orbConfig->getSecurity(); $this->securityConfig = $orbConfig->GetConfig("weborb/security"); $this->aclConfig = $orbConfig->GetConfig("weborb/acl"); $this->Initialize(); }
function checkCredentials($userid, $password, Request $message) { $security = ThreadContext::getORBConfig()->getSecurity(); if (!$security->authenticate($userid, $password)) { if (LOGGING) { Log::log(LoggingConstants::EXCEPTION, "invalid userid or password u: " . $userid . ", p: " . $password . "."); } throw new WebORBAuthenticationException("invalid userid or password"); } }
public function __construct($correlationId = null, $clientId = null, $obj = null, $headers = null) { $this->correlationId = $correlationId; $this->clientId = is_null($clientId) ? self::uuid() : $clientId; $this->messageId = self::uuid(); $this->timestamp = mktime(); $this->body = new BodyHolder(); $this->body->setBody($obj); $this->destination = ""; /*Hashtable*/ $responseMetadata = ThreadContext::getProperties(); $responseMetadata = $responseMetadata['responseMetadata']; if ($responseMetadata != null) { $this->headers = $responseMetadata; } else { $this->headers = $headers; } $this->timeToLive = 0; }
public function pass() { $credentials = ThreadContext::currentCallerCredentials(); if ($credentials != null) { /*String[]*/ $userRoles = ORBConfig::getInstance()->getSecurity()->getRolesProvider()->getUserRoles($credentials->getUserId()); // print_r($userRoles); // Log::log(LoggingConstants::MYDEBUG, ob_get_contents()); for ($i = 0, $max = count($userRoles); $i < $max; $i++) { if ($userRoles[$i] == $this->m_roleName) { return true; } } } // Log::log(LoggingConstants::MYDEBUG, "No roles"); return false; // $credentials = ThreadContext::currentCallerCredentials(); // // Log::log( LoggingConstants::DEBUG, "got credentials - " . ($credentials == null)); // // if($credentials == null) // { // Log::log( LoggingConstants::DEBUG, "credentials are null "); // // return false, authorization is required // return false; // } // // $userName = $credentials->getUserId(); // $password = $credentials->getPassword(); // // $orbConfig = ORBConfig::getInstance(); // $security = $orbConfig->getSecurity(); // // Log::log( LoggingConstants::DEBUG, "username " . $userName . " password " . $password ." role " . $this->m_roleName); // // // return $security->isInRole($userName, $password, $this->m_roleName); }
public function execute(Request $request) { if (LOGGING) { Log::log(LoggingConstants::DEBUG, "commandmessage " . $this->operation . " operation"); } /*Object*/ $returnValue = null; if ($this->operation == "0") { /*IDestination*/ $destObj = ORBConfig::getInstance()->getDataServices()->getDestinationManager()->getDestination($this->destination); /*Hashtable*/ $headers = array(); if ($destObj != null) { /*String*/ $selectorName = $this->headers["DSSelector"]; /*String*/ $subtopic = $this->headers["DSSubtopic"]; /*String*/ $dsId = $this->headers["DSId"]; /*Subscriber*/ $subscriber = new Subscriber($selectorName, $destObj); $subscriber->setDSId($dsId); $subscriber->setSubtopic($subtopic); $guid = new GUID(); $subscriber->setClientId($guid->toString()); SubscriptionsManager::getInstance()->addSubscriber($dsId, $subscriber); $destObj->getServiceHandler()->handleSubscribe($subscriber); } else { /*String*/ $error = "Unknown destination " . $this->destination . ". Cannot handle subscription request"; if (LOGGING) { Log::log(LoggingConstants::ERROR, $error); } return new ErrMessage($this->messageId, new Exception($error)); } return new AckMessage($this->messageId, $clientId, null, $headers); } else { if ($this->operation == "1") { /*String*/ $dsId = $this->headers["DSId"]; /*Subscriber*/ $subscriber = SubscriptionsManager::getInstance()->getSubscriber($dsId); if ($subscriber == null) { return new ErrMessage($this->messageId, new Exception("Unable to unsubscribe - unknown client")); } /*IDestination*/ $destination = $subscriber->getDestination(); $destination->getServiceHandler()->handleUnsubscribe($subscriber); SubscriptionsManager::getInstance()->removeSubscriber($dsId); } else { if ($this->operation == "2") { /*String*/ $dsId = $this->headers["DSId"]; /*Subscriber*/ $subscriber = SubscriptionsManager::getInstance()->getSubscriber($dsId); if ($subscriber == null) { /*String*/ $error = "Invalid client id " . $dsId; if (LOGGING) { Log::log(LoggingConstants::ERROR, $error); } return new ErrMessage($this->messageId, new Exception($error)); } /*IDestination*/ $destination = $subscriber->getDestination(); //Log::log( LoggingConstants::INFO, "Getting messages from " . $destination->getServiceHandler() ); /*ArrayList*/ $messages = $destination->getServiceHandler()->getMessages($subscriber); $subscriber->setLastRequestTime(microtime(true)); if (count($messages) == 0) { return new AckMessage(null, null, null, array()); } return $this->createCmdMessage("4", $messages); } else { if ($this->operation == "5") { /*Hashtable*/ $headers = array(); $guid = new GUID(); $headers["DSId"] = $guid->toString(); return new AckMessage($this->messageId, $this->clientId, null, $headers); } else { if ($this->operation == "9") { ThreadContext::setCallerCredentials(null); } else { if ($this->operation == "8") { $arr = $this->body->getBody(); $adaptingType = $arr[0]; $authData = split(":", base64_decode($adaptingType->defaultAdapt())); $credentials = new Credentials($authData[0], $authData[1]); $authHandler = ORBSecurity::getAuthenticationHandler(ThreadContext::getORBConfig()); if (LOGGING) { Log::log(LoggingConstants::DEBUG, "got auth handler " . get_class($authHandler)); } if ($authHandler == null) { $errorMessage = new ErrMessage($this->messageId, new ServiceException("Missing authentication handler")); $errorMessage->faultCode = "Client.Authentication"; return $errorMessage; } try { $authHandler->checkCredentials($credentials->getUserId(), $credentials->getPassword(), $request); if (LOGGING) { Log::log(LoggingConstants::DEBUG, "credentials are valid "); } ThreadContext::setCallerCredentials($credentials); } catch (Exception $e) { if (LOGGING) { Log::log(LoggingConstants::EXCEPTION, "authentication exception" . $e); } $errorMessage = new ErrMessage($this->messageId, $e); $errorMessage->faultCode = "Client.Authentication"; return $errorMessage; } return new AckMessage($this->messageId, $this->clientId, null); } } } } } } //echo $this->operation; exit; return new AckMessage($this->messageId, $this->clientId, $returnValue, array()); }
public function __construct() { $orbConfig = ThreadContext::getORBConfig(); $this->loggingConfig = $orbConfig->getConfig("weborb/logging"); $this->configNode = $this->loggingConfig->getConfigNode(); }
public function execute(Request $request) { if ("5" == $this->operation || "2" == $this->operation || "0" == $this->operation || "1" == $this->operation) { // $bodyData = $request->getRequestBodyData(); // $namedObject = $bodyData[0]; // /*CommandMessage*/ $commandMessage = new CommandMessage($this->operation, $namedObject); // return $commandMessage->execute($request); } else { if ("9" == $this->operation) { ThreadContext::setCallerCredentials(null); return new AckMessage($this->messageId, $this->clientId, null); } else { if ("8" == $this->operation) { $arr = $this->body->getBody(); $adaptingType = $arr[0]; $authData = split(":", base64_decode($adaptingType->defaultAdapt())); $credentials = new Credentials($authData[0], $authData[1]); $authHandler = ORBSecurity::getAuthenticationHandler(ThreadContext::getORBConfig()); if (LOGGING) { Log::log(LoggingConstants::DEBUG, "got auth handler " . get_class($authHandler)); } if (LOGGING) { Log::log(LoggingConstants::MYDEBUG, "file: 'ReqMessage.php' got auth handler " . get_class($authHandler)); } if ($authHandler == null) { $errorMessage = new ErrMessage($this->messageId, new ServiceException("Missing authentication handler")); $errorMessage->faultCode = "Client.Authentication"; return $errorMessage; } try { $authHandler->checkCredentials($credentials->getUserId(), $credentials->getPassword(), $request); if (LOGGING) { Log::log(LoggingConstants::DEBUG, "credentials are valid "); } ThreadContext::setCallerCredentials($credentials); } catch (Exception $e) { if (LOGGING) { Log::log(LoggingConstants::EXCEPTION, "authentication exception", $e); } $errorMessage = new ErrMessage($this->messageId, $e); $errorMessage->faultCode = "Client.Authentication"; return $errorMessage; } return new AckMessage($this->messageId, $this->clientId, null); } else { if (is_null($this->body->getBody())) { $arr = array(0); $this->body->setBody($arr); } else { if (!is_array($this->body->getBody())) { $arr = array($this->body->getBody()); $this->body->setBody($arr); } } try { // Log::log(LoggingConstants::MYDEBUG, $_SESSION["credentials"]); $resolvedName = ServiceRegistry::getMapping($this->destination); if ($resolvedName == "*") { $this->destination = $this->source; } $body = $this->body->getBody(); $returnValue = Invoker::handleInvoke($request, $this->destination, $this->operation, $body); return new AckMessage($this->messageId, $this->clientId, $returnValue); } catch (Exception $e) { if (LOGGING) { Log::log(LoggingConstants::EXCEPTION, "method invocation exception" . $e); } return new ErrMessage($this->messageId, $e); } } } } }