Skip to content

Commit 1e60744

Browse files
authored
Merge pull request #2 from itk-dev/feature/os2web_key-hashi-corp-vault
Feature/os2web key hashi corp vault
2 parents cd3e855 + 4c60162 commit 1e60744

File tree

14 files changed

+386
-212
lines changed

14 files changed

+386
-212
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1212
## [Unreleased]
1313

1414
- [#101](https://github.com/OS2Forms/os2forms/pull/101)
15-
Added support for os2web_key
15+
- Added support for `os2web_key` in Digital post
16+
- Added support for `os2web_key` in Fasit handler.
17+
- Switched from saving settings in key value store to config, i.e
18+
the module needs to be reconfigured.
1619
- Removed modules ldap_auth, logging_alerts, maillog
1720

1821
## [3.21.2] 2025-01-07

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dompdf/dompdf": "^2.0",
1212
"drupal/admin_toolbar": "^3.0",
1313
"drupal/advancedqueue": "^1.0",
14-
"drupal/cache_control_override": "^1.1|^2.0",
14+
"drupal/cache_control_override": "^1.1 || ^2.0",
1515
"drupal/clientside_validation": "^4.0",
1616
"drupal/coc_forms_auto_export": "^2.0@alpha",
1717
"drupal/config_entity_revisions": "dev-2.0.x",

modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Drupal\Core\File\FileSystem;
77
use Drupal\Core\Form\FormStateInterface;
88
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
9-
use Drupal\key\KeyRepository;
109
use Drupal\key\KeyRepositoryInterface;
1110
use Drupal\os2forms_dawa\Entity\DatafordelerMatrikula;
1211
use Drupal\os2web_audit\Service\Logger;
@@ -43,7 +42,7 @@ public function __construct(
4342
* {@inheritdoc}
4443
*/
4544
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
46-
/** @var Logger $auditLogger */
45+
/** @var \Drupal\os2web_audit\Service\Logger $auditLogger */
4746
$auditLogger = $container->get('os2web_audit.logger');
4847
/** @var \Drupal\key\KeyRepositoryInterface $keyRepository */
4948
$keyRepository = $container->get('key.repository');

modules/os2forms_digital_post/drush.services.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
services:
2-
Drupal\os2forms_digital_post\Drush\Commands\DigitalPostTestCommands:
2+
os2forms_digital_post.commands:
3+
class: \Drupal\os2forms_digital_post\Commands\DigitalPostTestCommands
34
arguments:
45
- '@Drupal\os2forms_digital_post\Helper\DigitalPostHelper'
56
- '@token'

modules/os2forms_digital_post/src/Drush/Commands/DigitalPostTestCommands.php renamed to modules/os2forms_digital_post/src/Commands/DigitalPostTestCommands.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Drupal\os2forms_digital_post\Drush\Commands;
3+
namespace Drupal\os2forms_digital_post\Commands;
44

55
use Drupal\Component\Serialization\Yaml;
66
use Drupal\Core\Utility\Token;

modules/os2forms_fasit/README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
# OS2Forms Fasit
22

3-
Adds [Fasit Schultz](https://schultz.dk/loesninger/schultz-fasit/)
4-
handler for archiving purposes.
3+
Adds [Fasit Schultz](https://schultz.dk/loesninger/schultz-fasit/) handler for archiving purposes.
54

65
For usage in danish, see [BENYTTELSE](docs/BENYTTELSE.md).
76

87
## Installation
98

10-
```sh
9+
```shell
1110
drush pm:enable os2forms_fasit
1211
```
1312

1413
## Settings
1514

16-
Configure Fasit API `base url` and a way of getting
17-
certificate on `/admin/os2forms_fasit/settings`.
15+
Go to `/admin/os2forms_fasit/settings` and configure the module.
1816

1917
### Certificate
2018

21-
The certificate must be in `pem` or `cer` format and
22-
must be whitelisted by Fasit Schultz.
23-
For this the certificate thumbprint,
24-
in lowercase and without colons, is needed.
19+
The certificate must be in `pem` or `cer` format and must be whitelisted by Fasit Schultz. For this the certificate
20+
thumbprint, in lowercase and without colons, is needed.
2521
To get the thumbprint in the correct format from the command line run
2622

27-
```sh
23+
```shell
2824
openssl x509 -in SOME_CERTIFICATE.pem -noout -fingerprint | cut -d= -f2 | sed 's/://g' | tr '[:upper:]' '[:lower:]'
2925
```
3026

31-
Example output
27+
Example output:
3228

33-
```sh
29+
```shell
3430
6acb261f393172d87fa3997cec86569759a8528a
3531
```
3632

@@ -42,13 +38,13 @@ called `fasit_queue`.
4238

4339
The queue should be processed with `drush`:
4440

45-
```sh
41+
```shell
4642
drush advancedqueue:queue:process fasit_queue
4743
```
4844

4945
List the queue (and all other queues) with
5046

51-
```sh
47+
```shell
5248
drush advancedqueue:queue:list
5349
```
5450

modules/os2forms_fasit/os2forms_fasit.info.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ dependencies:
88
- drupal:advancedqueue
99
- os2forms:os2forms_attachment
1010
- os2web:os2web_audit
11+
- os2web_key:os2web_key
1112
configure: os2forms_fasit.admin.settings
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Install hooks for os2forms_fasit.
6+
*/
7+
8+
/**
9+
* Implements hook_update_N().
10+
*/
11+
function os2forms_fasit_update_9001(): void {
12+
\Drupal::service('module_installer')->install([
13+
'key',
14+
], TRUE);
15+
}
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
services:
22
Drupal\os2forms_fasit\Helper\Settings:
3+
autowire: true
34
arguments:
4-
- "@keyvalue"
5+
$keyRepository: "@key.repository"
56

67
Drupal\os2forms_fasit\Helper\CertificateLocatorHelper:
7-
arguments:
8-
- "@Drupal\\os2forms_fasit\\Helper\\Settings"
8+
autowire: true
99

1010
Drupal\os2forms_fasit\Helper\FasitHelper:
11+
autowire: true
1112
arguments:
12-
- '@http_client'
13-
- '@entity_type.manager'
14-
- "@Drupal\\os2forms_fasit\\Helper\\Settings"
15-
- "@Drupal\\os2forms_fasit\\Helper\\CertificateLocatorHelper"
16-
- "@os2web_audit.logger"
13+
$auditLogger: "@os2web_audit.logger"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Drupal\os2forms_fasit\Drush\Commands;
4+
5+
use Drupal\os2forms_fasit\Helper\FasitHelper;
6+
use Drush\Commands\DrushCommands;
7+
use Symfony\Component\DependencyInjection\ContainerInterface;
8+
9+
/**
10+
* A Drush commandfile.
11+
*/
12+
final class FasitTestCommand extends DrushCommands {
13+
14+
/**
15+
* Constructs a FasitTestCommand object.
16+
*/
17+
public function __construct(
18+
private readonly FasitHelper $helper,
19+
) {
20+
parent::__construct();
21+
}
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
public static function create(ContainerInterface $container) {
27+
return new static(
28+
$container->get(FasitHelper::class),
29+
);
30+
}
31+
32+
/**
33+
* Test API access.
34+
*
35+
* @command os2forms-fasit:test:api
36+
* @usage os2forms-fasit:test:api --help
37+
*/
38+
public function testApi(): void {
39+
try {
40+
$this->helper->pingApi();
41+
$this->io()->success('Successfully connected to Fasit API');
42+
}
43+
catch (\Throwable $t) {
44+
$this->io()->error($t->getMessage());
45+
}
46+
47+
}
48+
49+
}

0 commit comments

Comments
 (0)