|
|
@ -15,6 +15,7 @@ class IslandoraSettingsForm extends ConfigFormBase { |
|
|
|
|
|
|
|
|
|
|
|
const CONFIG_NAME = 'islandora.settings'; |
|
|
|
const CONFIG_NAME = 'islandora.settings'; |
|
|
|
const BROKER_URL = 'broker_url'; |
|
|
|
const BROKER_URL = 'broker_url'; |
|
|
|
|
|
|
|
const JWT_EXPIRY = 'jwt_expiry'; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@inheritdoc} |
|
|
|
* {@inheritdoc} |
|
|
@ -44,6 +45,12 @@ class IslandoraSettingsForm extends ConfigFormBase { |
|
|
|
'#default_value' => $config->get(self::BROKER_URL) ? $config->get(self::BROKER_URL) : 'tcp://localhost:61613', |
|
|
|
'#default_value' => $config->get(self::BROKER_URL) ? $config->get(self::BROKER_URL) : 'tcp://localhost:61613', |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form[self::JWT_EXPIRY] = [ |
|
|
|
|
|
|
|
'#type' => 'textfield', |
|
|
|
|
|
|
|
'#title' => $this->t('JWT Expiry'), |
|
|
|
|
|
|
|
'#default_value' => $config->get(self::JWT_EXPIRY) ? $config->get(self::JWT_EXPIRY) : '+2 hour', |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
return parent::buildForm($form, $form_state); |
|
|
|
return parent::buildForm($form, $form_state); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -74,6 +81,18 @@ class IslandoraSettingsForm extends ConfigFormBase { |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Validate jwt expiry as a valid time string. |
|
|
|
|
|
|
|
$expiry = $form_state->getValue(self::JWT_EXPIRY); |
|
|
|
|
|
|
|
if (strtotime($expiry) === FALSE) { |
|
|
|
|
|
|
|
$form_state->setErrorByName( |
|
|
|
|
|
|
|
self::JWT_EXPIRY, |
|
|
|
|
|
|
|
$this->t( |
|
|
|
|
|
|
|
'"@exipry" is not a valid time or interval expression.', |
|
|
|
|
|
|
|
['@expiry' => $expiry] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -84,6 +103,7 @@ class IslandoraSettingsForm extends ConfigFormBase { |
|
|
|
|
|
|
|
|
|
|
|
$config |
|
|
|
$config |
|
|
|
->set(self::BROKER_URL, $form_state->getValue(self::BROKER_URL)) |
|
|
|
->set(self::BROKER_URL, $form_state->getValue(self::BROKER_URL)) |
|
|
|
|
|
|
|
->set(self::JWT_EXPIRY, $form_state->getValue(self::JWT_EXPIRY)) |
|
|
|
->save(); |
|
|
|
->save(); |
|
|
|
|
|
|
|
|
|
|
|
parent::submitForm($form, $form_state); |
|
|
|
parent::submitForm($form, $form_state); |
|
|
|