/** * Initialize the login module. This stores the subject, callbackHandler and sharedState and options * for the login session. Subclasses should override if they need to process their own options. A call * to parent::initialize() must be made in the case of an override. * * The following parameters can by default be passed from the configuration. * * rolesPathPrefix: The naming directory prefix used to load the user's roles * userPathPrefix: The naming directory prefix used to load the user * * @param \AppserverIo\Psr\Security\Auth\Subject $subject The Subject to update after a successful login * @param \AppserverIo\Psr\Security\Auth\Callback\CallbackHandlerInterface $callbackHandler The callback handler that will be used to obtain the user identity and credentials * @param \AppserverIo\Collections\MapInterface $sharedState A map shared between all configured login module instances * @param \AppserverIo\Collections\MapInterface $params The parameters passed to the login module * * @return void */ public function initialize(Subject $subject, CallbackHandlerInterface $callbackHandler, MapInterface $sharedState, MapInterface $params) { // call the parent method parent::initialize($subject, $callbackHandler, $sharedState, $params); // load the parameters from the map $this->userPathPrefix = $params->get(ParamKeys::USER_PATH_PREFIX); $this->rolesPathPrefix = $params->get(ParamKeys::ROLES_PATH_PREFIX); }
/** * Initialize the login module. This stores the subject, callbackHandler and sharedState and options * for the login session. Subclasses should override if they need to process their own options. A call * to parent::initialize() must be made in the case of an override. * * The following parameters can by default be passed from the configuration. * * lookupName: The datasource name used to lookup in the naming directory * rolesQuery: The database query used to load the user's roles * principalsQuery: The database query used to load the user * * @param \AppserverIo\Psr\Security\Auth\Subject $subject The Subject to update after a successful login * @param \AppserverIo\Psr\Security\Auth\Callback\CallbackHandlerInterface $callbackHandler The callback handler that will be used to obtain the user identity and credentials * @param \AppserverIo\Collections\MapInterface $sharedState A map shared between all configured login module instances * @param \AppserverIo\Collections\MapInterface $params The parameters passed to the login module * * @return void */ public function initialize(Subject $subject, CallbackHandlerInterface $callbackHandler, MapInterface $sharedState, MapInterface $params) { // call the parent method parent::initialize($subject, $callbackHandler, $sharedState, $params); // load the parameters from the map $this->lookupName = new String($params->get(ParamKeys::LOOKUP_NAME)); $this->rolesQuery = new String($params->get(ParamKeys::ROLES_QUERY)); $this->principalsQuery = new String($params->get(ParamKeys::PRINCIPALS_QUERY)); }