Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
645 changes: 496 additions & 149 deletions locales/en/LC_MESSAGES/oidc.po

Large diffs are not rendered by default.

614 changes: 520 additions & 94 deletions locales/es/LC_MESSAGES/oidc.po

Large diffs are not rendered by default.

642 changes: 508 additions & 134 deletions locales/fr/LC_MESSAGES/oidc.po

Large diffs are not rendered by default.

614 changes: 614 additions & 0 deletions locales/hr/LC_MESSAGES/oidc.po

Large diffs are not rendered by default.

608 changes: 526 additions & 82 deletions locales/it/LC_MESSAGES/oidc.po

Large diffs are not rendered by default.

556 changes: 477 additions & 79 deletions locales/nl/LC_MESSAGES/oidc.po

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/Forms/ClientForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,40 +353,40 @@ protected function buildForm(): void
$this->setMethod('POST');
$this->addComponent($this->csrfProtection, Form::ProtectorId);

$this->addText('name', '{oidc:client:name}')
$this->addText('name', Translate::noop('Name'))
->setHtmlAttribute('class', 'full-width')
->setMaxLength(255)
->setRequired(Translate::noop('Name is required.'));

$this->addTextArea('description', '{oidc:client:description}', null, 3)
$this->addTextArea('description', Translate::noop('Description'), null, 3)
->setHtmlAttribute('class', 'full-width');
$this->addTextArea('redirect_uri', '{oidc:client:redirect_uri}', null, 5)
$this->addTextArea('redirect_uri', Translate::noop('Redirect URI'), null, 5)
->setHtmlAttribute('class', 'full-width')
->setRequired(Translate::noop('At least one redirect URI is required.'));

$this->addCheckbox('is_enabled', '{oidc:client:is_enabled}');
$this->addCheckbox('is_enabled', Translate::noop('Activated'));

$this->addCheckbox('is_confidential', '{oidc:client:is_confidential}');

$this->addSelect('auth_source', '{oidc:client:auth_source}:')
$this->addSelect('auth_source', Translate::noop('Authentication source'))
->setHtmlAttribute('class', 'full-width')
->setItems($this->sspBridge->auth()->source()->getSources(), false)
->setPrompt(Translate::noop('-'));

$scopes = $this->getScopes();

$this->addMultiSelect('scopes', '{oidc:client:scopes}', $scopes, 10)
$this->addMultiSelect('scopes', Translate::noop('Scopes'), $scopes, 10)
->setHtmlAttribute('class', 'full-width')
->setRequired(Translate::noop('At least one scope is required.'));

$this->addText('owner', '{oidc:client:owner}')
$this->addText('owner', Translate::noop('Owner'))
->setMaxLength(190);
$this->addTextArea('post_logout_redirect_uri', '{oidc:client:post_logout_redirect_uri}', null, 5)
$this->addTextArea('post_logout_redirect_uri', Translate::noop('Post-logout Redirect URIs'), null, 5)
->setHtmlAttribute('class', 'full-width');
$this->addTextArea('allowed_origin', '{oidc:client:allowed_origin}', null, 5)
$this->addTextArea('allowed_origin', Translate::noop('Allowed origins for public clients'), null, 5)
->setHtmlAttribute('class', 'full-width');

$this->addText('backchannel_logout_uri', '{oidc:client:backchannel_logout_uri}')
$this->addText('backchannel_logout_uri', Translate::noop('Back-Channel Logout URI'))
->setHtmlAttribute('class', 'full-width');

$this->addText('entity_identifier', 'Entity Identifier')
Expand Down
7 changes: 6 additions & 1 deletion src/Services/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use SimpleSAML\Configuration;
use SimpleSAML\Database;
use SimpleSAML\Error\Exception;
use SimpleSAML\Locale\Translate;
use SimpleSAML\Metadata\MetaDataStorageHandler;
use SimpleSAML\Module\oidc\Admin\Menu;
use SimpleSAML\Module\oidc\Bridges\PsrHttpBridge;
Expand Down Expand Up @@ -147,7 +148,11 @@
$helpers = new Helpers();
$this->services[Helpers::class] = $helpers;

$csrfProtection = new CsrfProtection('{oidc:client:csrf_error}', $session);
$csrfProtection = new CsrfProtection(
Translate::noop('Your session has expired. Please return to the home page and try again.'),
$session,
);

Check warning on line 154 in src/Services/Container.php

View check run for this annotation

Codecov / codecov/patch

src/Services/Container.php#L151-L154

Added lines #L151 - L154 were not covered by tests

$formFactory = new FormFactory(
$moduleConfig,
$csrfProtection,
Expand Down
8 changes: 4 additions & 4 deletions templates/clients.twig
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
<small>{{ client.description }}</small>
<br>
<small>
{{ 'Registration:'|trans }} {{ client.registrationType.description }} |
{{ 'Created at:'|trans }} {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
{{ 'Updated at:'|trans }} {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
{{ 'Expires at:'|trans }} {{ client.expiresAt ? client.expiresAt|date() : 'never' }}
{{ 'Registration'|trans }}: {{ client.registrationType.description }} |
{{ 'Created at'|trans }}: {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
{{ 'Updated at'|trans }}: {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
{{ 'Expires at'|trans }}: {{ client.expiresAt ? client.expiresAt|date() : 'never'|trans }}
</small>
</td>
<td>
Expand Down
4 changes: 2 additions & 2 deletions templates/clients/includes/form.twig
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<span class="pure-form-message red-text">{{ form.scopes.getError }}</span>
{% endif %}

<label for="frm-backchannel_logout_uri">{{ 'Back-Channel Logout URI'|trans }}</label>
<label for="frm-backchannel_logout_uri">{{ 'Back-channel Logout URI'|trans }}</label>
{{ form.backchannel_logout_uri.control | raw }}
<span class="pure-form-message">
{% trans %}Enter if client supports Back-Channel Logout specification. When logout is initiated at the OpenID Provider, it will send a Logout Token to this URI in order to notify the client about that event. Must be a valid URI. Example: https://example.org/foo?bar=1{% endtrans %}
Expand All @@ -96,7 +96,7 @@
<span class="pure-form-message red-text">{{ form.backchannel_logout_uri.getError }}</span>
{% endif %}

<label for="frm-post_logout_redirect_uri">{{ 'Post-Logout Redirect URIs'|trans }}</label>
<label for="frm-post_logout_redirect_uri">{{ 'Post-logout Redirect URIs'|trans }}</label>
{{ form.post_logout_redirect_uri.control | raw }}
<span class="pure-form-message">
{% trans %}Allowed redirect URIs to use after client initiated logout. Must be a valid URI, one per line. Example: https://example.org/foo?bar=1{% endtrans %}
Expand Down
8 changes: 4 additions & 4 deletions templates/clients/show.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
</div>

<div class="">
{{ 'Registration:'|trans }} {{ client.registrationType.description }} |
{{ 'Created at:'|trans }} {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
{{ 'Updated at:'|trans }} {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
{{ 'Expires at:'|trans }} {{ client.expiresAt ? client.expiresAt|date() : 'never' }}
{{ 'Registration'|trans }}: {{ client.registrationType.description }} |
{{ 'Created at'|trans }}: {{ client.createdAt ? client.createdAt|date() : 'n/a' }} |
{{ 'Updated at'|trans }}: {{ client.updatedAt ? client.updatedAt|date() : 'n/a' }} |
{{ 'Expires at'|trans }}: {{ client.expiresAt ? client.expiresAt|date() : 'never'|trans }}
</div>

<br>
Expand Down
4 changes: 1 addition & 3 deletions templates/config/migrations.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
{% endif %}

<div class="message-box">
Before running the migrations, make sure that the database user has proper privileges to change the scheme
(for example, <kbd>alter, create, drop, index</kbd>). After running the migrations, it is a good practice to remove
those privileges.
{{ 'Before running the migrations, make sure that the database user has proper privileges to change the scheme (for example, <kbd>alter, create, drop, index</kbd>). After running the migrations, it is a good practice to remove those privileges.'|trans }}
</div>

{% endblock oidcContent -%}
2 changes: 1 addition & 1 deletion templates/includes/menu.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<li>
<a href="{{ item.hrefPath }}"
class="{{ item.hrefPath == oidcMenu.activeHrefPath ? 'active' : '' }}"
> {{ item.label }} </a>
> {{ item.label|trans }} </a>
</li>
{% endfor %}
</ul>
Expand Down
10 changes: 5 additions & 5 deletions templates/logout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
{% block oidcContent %}
<h2>
{% if wasLogoutActionCalled %}
{{ '{oidc:logout:page_title_success}'|trans }}
{{ 'Logout Successful'|trans }}
{% else %}
{{ '{oidc:logout:page_title_fail}'|trans }}
{{ 'Logout Failed'|trans }}
{% endif %}
</h2>


<div>
<h3>
{{ '{oidc:logout:info_title}'|trans }}
{{ 'Info'|trans }}
</h3>
<p>
{% if wasLogoutActionCalled %}
{{ '{oidc:logout:info_message_success}'|trans }}
{{ 'You can now close this window or navigate to another page.'|trans }}
{% else %}
{{ '{oidc:logout:info_message_fail}'|trans }}
{{ 'Requested session was not found or it is expired.'|trans }}
{% endif %}
</p>
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/tests/trust-chain-resolution.twig
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
<h4>{{ 'Resolved chains'|trans }}</h4>
{% if trustChainBag|default %}
<p>
{{ 'Total chains:'|trans }} {{ trustChainBag.getCount }}
{{ 'Total chains'|trans }}: {{ trustChainBag.getCount }}
</p>
{% for index, trustChain in trustChainBag.getAll %}
<p>
{{ loop.index }}. {{ 'Trust Anchor ID:'|trans }} {{ trustChain.getResolvedTrustAnchor.getIssuer }}
{{ loop.index }}. {{ 'Trust Anchor ID'|trans }}: {{ trustChain.getResolvedTrustAnchor.getIssuer }}
<br><br>
{{ 'Path:'|trans }}
{{ 'Path'|trans }}:
<br>
{% for entity in trustChain.getEntities %}
{% if loop.index > 1 %}
Expand All @@ -69,7 +69,7 @@
{% endfor %}

<br>
{{ 'Resolved metadata:' }}<br>
{{ 'Resolved metadata' }}:<br>
{% if resolvedMetadata[index]|default is not empty %}
<code class="code-box code-box-content">
{{- resolvedMetadata[index]|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_UNESCAPED_SLASHES')) -}}
Expand Down
66 changes: 66 additions & 0 deletions tests/unit/src/Factories/FormFactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

declare(strict_types=1);

namespace SimpleSAML\Test\Module\oidc\unit\Factories;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use SimpleSAML\Module\oidc\Bridges\SspBridge;
use SimpleSAML\Module\oidc\Factories\FormFactory;
use SimpleSAML\Module\oidc\Forms\ClientForm;
use SimpleSAML\Module\oidc\Forms\Controls\CsrfProtection;
use SimpleSAML\Module\oidc\Helpers;
use SimpleSAML\Module\oidc\ModuleConfig;

#[CoversClass(FormFactory::class)]
#[UsesClass(ClientForm::class)]
class FormFactoryTest extends TestCase
{
protected MockObject $moduleConfigMock;
protected MockObject $csrfProtectionMock;
protected MockObject $sspBridgeMock;
protected MockObject $helpersMock;

protected function setUp(): void
{
$this->moduleConfigMock = $this->createMock(ModuleConfig::class);
$this->csrfProtectionMock = $this->createMock(CsrfProtection::class);
$this->sspBridgeMock = $this->createMock(SspBridge::class);
$this->helpersMock = $this->createMock(Helpers::class);
}

protected function sut(
?ModuleConfig $moduleConfig = null,
?CsrfProtection $csrfProtection = null,
?SspBridge $sspBridge = null,
?Helpers $helpers = null,
): FormFactory {
$moduleConfig ??= $this->moduleConfigMock;
$csrfProtection ??= $this->csrfProtectionMock;
$sspBridge ??= $this->sspBridgeMock;
$helpers ??= $this->helpersMock;

return new FormFactory(
$moduleConfig,
$csrfProtection,
$sspBridge,
$helpers,
);
}

public function testCanConstruct(): void
{
$this->assertInstanceOf(FormFactory::class, $this->sut());
}

public function testCanBuildClientForm(): void
{
$this->assertInstanceOf(
ClientForm::class,
$this->sut()->build(ClientForm::class),
);
}
}