added redirect field in casost config entity

parent e7629bed
......@@ -21,6 +21,7 @@ class CASLogin extends ControllerBase
protected $serverHostname;
protected $serverPort;
protected $serverUri;
protected $redirectUrl;
protected $changeSessionId;
protected $CASServerCACert;
protected $CASServerCNValidate;
......@@ -75,6 +76,7 @@ class CASLogin extends ControllerBase
$this->serverHostname = $CASOSTConfig->serverhostname->value;
$this->serverPort = $CASOSTConfig->serverport->value;
$this->serverUri = $CASOSTConfig->serveruri->value === null ? '' : $CASOSTConfig->serveruri->value;
$this->redirectUrl = $CASOSTConfig->redirecturl->value;
$this->changeSessionId = $CASOSTConfig->changesessionid->value;
$this->CASServerCACert = $CASOSTConfig->casservercacert->value;
$this->CASServerCNValidate = $CASOSTConfig->casservercnvalidate->value;
......@@ -175,8 +177,7 @@ class CASLogin extends ControllerBase
// $this->logger->warning('cn=' . $filterAttribute('cn'));
$epalToken = $this->authenticatePhase2($request, $CASUser, $filterAttribute('cn'));
if ($epalToken) {
return new RedirectResponse('/dist/#/school?auth_token=' . $epalToken.'&auth_role=director', 302, []);
return new RedirectResponse($this->redirectUrl . '?auth_token=' . $epalToken.'&auth_role=director', 302, []);
} else {
$response = new Response();
$response->setContent('forbidden');
......
......@@ -290,6 +290,26 @@ class CASOSTConfig extends ContentEntityBase implements CASOSTConfigInterface
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true);
$fields['redirecturl'] = BaseFieldDefinition::create('string')
->setLabel(t('Redirect Url'))
->setDescription(t('Redirect Url'))
->setSettings(array(
'max_length' => 200,
'text_processing' => 0,
))
->setDefaultValue('/dist/#/school')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true);
$fields['changesessionid'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Change Session Id'))
->setDescription(t('A boolean indicating whether we change session id.'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment