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
3 changes: 2 additions & 1 deletion lib/Handler/CertificateEngine/AEngineHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ public function readCertificate(string $certificate, string $privateKey): array
public function getCaId(): string {
$caId = $this->caIdentifierService->getCaId();
if (empty($caId)) {
$caId = $this->caIdentifierService->generateCaId($this->getName());
$this->appConfig->clearCache(true);
$caId = $this->caIdentifierService->getCaId() ?: $this->caIdentifierService->generateCaId($this->getName());
}
return $caId;
}
Expand Down
50 changes: 34 additions & 16 deletions tests/integration/features/sign/request.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Feature: request-signature
Scenario: Get error when try to request to sign isn't manager
Given user "signer1" exists
And as user "admin"
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And as user "signer1"
And run the command "libresign:configure:openssl --cn test" with result code 0
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"base64":""} |
| users | [{"identify":{"account":"signer1"}}] |
Expand All @@ -15,7 +17,8 @@ Feature: request-signature

Scenario: Get error when try to request to sign without file name
Given as user "admin"
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"invalid":""} |
| users | [{"identify":{"account":"signer1"}}] |
Expand All @@ -34,7 +37,8 @@ Feature: request-signature
And my inbox is empty
And reset notifications of user "signer1"
And reset notifications of user "signer2"
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
| users | [{"identify":{"account":"signer1"}}] |
Expand Down Expand Up @@ -67,7 +71,8 @@ Feature: request-signature
And my inbox is empty
And reset notifications of user "signer1"
And reset notifications of user "signer2"
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
| users | [{"identify":{"account":"signer1"}}] |
Expand All @@ -94,7 +99,8 @@ Feature: request-signature
Scenario: Request to sign with error when the user is not authenticated
Given as user "admin"
And user "signer1" exists
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And reset notifications of user "signer1"
And my inbox is empty
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
Expand All @@ -115,7 +121,8 @@ Feature: request-signature
Scenario: Request to sign with error when the authenticated user have an email different of signer
Given as user "admin"
And user "signer1" exists
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And reset notifications of user "signer1"
And set the email of user "signer1" to "[email protected]"
And my inbox is empty
Expand All @@ -140,7 +147,8 @@ Feature: request-signature
Scenario: Request to sign with error when the link was expired
Given as user "admin"
And my inbox is empty
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And run the command "config:app:set libresign maximum_validity --value=1 --type=integer" with result code 0
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
Expand All @@ -162,7 +170,8 @@ Feature: request-signature
Scenario: Request to sign with success when is necessary to renew the link
Given as user "admin"
And my inbox is empty
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
| value | (string)[{"name":"email","enabled":true,"mandatory":true,"can_create_account":false}] |
And sending "post" to ocs "/apps/libresign/api/v1/request-signature"
Expand Down Expand Up @@ -228,7 +237,8 @@ Feature: request-signature
Scenario: Request to sign with success using account as identifier
Given as user "admin"
And user "signer1" exists
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And set the email of user "signer1" to "[email protected]"
And reset notifications of user "signer1"
And my inbox is empty
Expand Down Expand Up @@ -266,7 +276,8 @@ Feature: request-signature

Scenario: Request to sign with error using account as identifier with invalid email
Given as user "admin"
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
| users | [{"identify":{"account":"invaliddomain.test"}}] |
Expand All @@ -278,7 +289,8 @@ Feature: request-signature

Scenario: Request to sign with error using email as account identifier
Given as user "admin"
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
| users | [{"identify":{"account":"[email protected]"}}] |
Expand All @@ -290,7 +302,9 @@ Feature: request-signature

Scenario: Request to sign with success using email as identifier and URL as file
Given as user "admin"
And run the command "libresign:configure:openssl --cn test" with result code 0
And as user "admin"
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And my inbox is empty
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
| file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} |
Expand All @@ -303,7 +317,8 @@ Feature: request-signature
Scenario: Request to sign with success using account as identifier and URL as file
Given as user "admin"
And user "signer1" exists
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And set the email of user "signer1" to ""
And reset notifications of user "signer1"
And my inbox is empty
Expand All @@ -321,7 +336,8 @@ Feature: request-signature

Scenario: Request to sign with success using email as identifier
Given as user "admin"
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And set the email of user "signer1" to "[email protected]"
And my inbox is empty
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
Expand All @@ -334,7 +350,8 @@ Feature: request-signature

Scenario: Request to sign using email as identifier and when is necessary to use visible elements
Given as user "admin"
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods"
| value | (string)[{"name":"email","enabled":true,"mandatory":true,"can_create_account":false}] |
And I send a file to be signed
Expand Down Expand Up @@ -363,7 +380,8 @@ Feature: request-signature
Scenario: Request to sign with success using multiple users
Given as user "admin"
And user "signer1" exists
And run the command "libresign:configure:openssl --cn test" with result code 0
And sending "post" to ocs "/apps/libresign/api/v1/admin/certificate/openssl"
| rootCert | {"commonName":"test"} |
And set the email of user "signer1" to ""
And my inbox is empty
When sending "post" to ocs "/apps/libresign/api/v1/request-signature"
Expand Down
Loading