AppserverIo\Appserver\ServletEngine\Security\Realm::injectConfiguration PHP Method

injectConfiguration() public method

Inject the realm's configuration.
public injectConfiguration ( AppserverIo\Appserver\Core\Api\Node\SecurityDomainNodeInterface $configuration ) : void
$configuration AppserverIo\Appserver\Core\Api\Node\SecurityDomainNodeInterface The realm's configuration
return void
    public function injectConfiguration(SecurityDomainNodeInterface $configuration)
    {
        $this->configruation = $configuration;
    }

Usage Example

 /**
  * Initializes the manager instance.
  *
  * @param \AppserverIo\Psr\Application\ApplicationInterface $application The application instance
  *
  * @return void
  * @see \AppserverIo\Psr\Application\ManagerInterface::initialize()
  *
  * @throws \Exception
  */
 public function initialize(ApplicationInterface $application)
 {
     // query whether or not the web application folder exists
     if (is_dir($this->getWebappPath()) === false) {
         return;
     }
     // initialize the map for the realms
     $realms = new HashMap();
     // query whether or not we've manager configuration found
     /** @var \AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $managerNode */
     if ($managerNode = $this->getManagerConfiguration()) {
         // initialize the security domains found in the manager configuration
         /** @var \AppserverIo\Appserver\Core\Api\Node\SecurityDomainNodeInterface $securityDomainNode */
         foreach ($this->getManagerConfiguration()->getSecurityDomains() as $securityDomainNode) {
             // create the realm instance
             $realm = new Realm($this, $securityDomainNode->getName());
             $realm->injectConfiguration($securityDomainNode);
             // add the initialized security domain to the map
             $realms->add($realm->getName(), $realm);
         }
     }
     // inject the map with the realms
     $this->injectRealms($realms);
     // initialize the deployment descriptor parser and parse the web application's deployment descriptor for servlets
     $deploymentDescriptorParser = new DeploymentDescriptorParser();
     $deploymentDescriptorParser->injectAuthenticationContext($this);
     $deploymentDescriptorParser->parse();
 }