Commit 48c94720 authored by Oliver Bartsch's avatar Oliver Bartsch

[TASK] Raise max token lifetime to 1 year

Currently the default lifetime, if not specified, is 7 days.
This is now also displayed as the default value in the
"Create access token" form.
parent 9e5c7a5b
......@@ -54,6 +54,7 @@ class TokenController extends ActionController implements LoggerAwareInterface
$this->view->assignMultiple([
'actions' => self::API_ACTIONS,
'activeTab' => $this->getActiveTab(),
'expires' => strtotime('+7 day', (int)$this->context->getPropertyFromAspect('date', 'timestamp')),
'extensions' => $this->extensionRepository->findByFrontendUser(
(string)$this->context->getPropertyFromAspect('frontend.user', 'username')
)
......
......@@ -25,7 +25,7 @@ use TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator;
*/
class TokenCreationValidator extends AbstractValidator
{
private const MAX_LIFETIME = 8035200;
private const MAX_LIFETIME = 31536000;
private const AVAILABLE_SCOPES = [
'extension:read',
'extension:write',
......
<div class="row">
<div class="col-md-8">
<p>
Enter a name, select the expiration date (max 3 months), the scopes and the extensions for the token.
Enter a name, select the expiration date (max 1 year), the scopes and the extensions for the token.
Approve by entering your password.
</p>
</div>
......@@ -16,7 +16,7 @@
<div class="form-group row">
<div class="col-md-8">
<label for="tokenExpires">Expiration date</label>
<f:form.textfield type="date" class="form-control" id="tokenExpires" property="expires" value="" />
<f:form.textfield type="date" class="form-control" id="tokenExpires" property="expires" value="{expires -> f:format.date(format: 'Y-m-d')}" />
</div>
</div>
<div class="form-group row">
......
......@@ -20,7 +20,8 @@
<div class="tab-content">
<f:for each="{actions}" as="action">
<div class="tab-pane mt-3 {f:if(condition: '{activeTab} == {action}', then: 'active')}" id="{action}" role="tabpanel">
<f:render partial="Token/{action -> f:format.case(mode: 'capital')}" arguments="{settings: settings, extensions: extensions}" />
<f:render partial="Token/{action -> f:format.case(mode: 'capital')}"
arguments="{settings: settings, expires: expires, extensions: extensions}" />
</div>
</f:for>
</div>
......
......@@ -209,7 +209,7 @@
"style": "form",
"explode": true,
"schema": {
"maximum": 8035200,
"maximum": 31536000,
"minimum": 60,
"type": "integer",
"default": 604800
......@@ -3227,7 +3227,7 @@
"style": "form",
"explode": true,
"schema": {
"maximum": 8035200,
"maximum": 31536000,
"minimum": 60,
"type": "integer",
"default": 604800
......
......@@ -146,7 +146,7 @@ paths:
style: form
explode: true
schema:
maximum: 8035200
maximum: 31536000
minimum: 60
type: integer
default: 604800
......@@ -2132,7 +2132,7 @@ components:
style: form
explode: true
schema:
maximum: 8035200
maximum: 31536000
minimum: 60
type: integer
default: 604800
......
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