|
| 1 | +Feature: TSA Integration - End-to-End Workflow |
| 2 | + |
| 3 | + Background: |
| 4 | + Given as user "admin" |
| 5 | + And user "signer1" exists |
| 6 | + And run the command "libresign:install --use-local-cert --java" with result code 0 |
| 7 | + And run the command "libresign:install --use-local-cert --jsignpdf" with result code 0 |
| 8 | + And run the command "libresign:install --use-local-cert --pdftk" with result code 0 |
| 9 | + And run the command "libresign:configure:openssl --cn=Common\ Name --c=BR --o=Organization --st=State\ of\ Company --l=City\ Name --ou=Organization\ Unit" with result code 0 |
| 10 | + |
| 11 | + Scenario: TSA workflow - Successfully signs document with timestamp |
| 12 | + Given run the command "config:app:set libresign tsa_url --value=https://freetsa.org/tsr --type=string" with result code 0 |
| 13 | + And run the command "config:app:set libresign tsa_auth_type --value=none --type=string" with result code 0 |
| 14 | + # And run the command "config:app:set libresign tsa_policy_oid --value=1.2.3.4.5 --type=string" with result code 0 |
| 15 | + And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods" |
| 16 | + | value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"clickToSign":{"enabled":true}},"signatureMethodEnabled":"clickToSign"}] | |
| 17 | + And the response should have a status code 200 |
| 18 | + When sending "post" to ocs "/apps/libresign/api/v1/request-signature" |
| 19 | + | file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} | |
| 20 | + | users | [{"displayName": "TSA Signer","identify": {"account": "signer1"}}] | |
| 21 | + | name | TSA Document Test | |
| 22 | + Then the response should have a status code 200 |
| 23 | + And as user "signer1" |
| 24 | + And sending "get" to ocs "/apps/libresign/api/v1/file/list" |
| 25 | + Then the response should be a JSON array with the following mandatory values |
| 26 | + | key | value | |
| 27 | + | (jq).ocs.data.data[0].name | TSA Document Test | |
| 28 | + And fetch field "(SIGN_UUID)ocs.data.data.0.signers.0.sign_uuid" from previous JSON response |
| 29 | + And fetch field "(FILE_UUID)ocs.data.data.0.uuid" from previous JSON response |
| 30 | + When sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID>" |
| 31 | + | method | clickToSign | |
| 32 | + Then the response should have a status code 200 |
| 33 | + And the response should be a JSON array with the following mandatory values |
| 34 | + | key | value | |
| 35 | + | (jq).ocs.meta.status | ok | |
| 36 | + | (jq).ocs.meta.statuscode | 200 | |
| 37 | + | (jq).ocs.data.action | 3500 | |
| 38 | + | (jq).ocs.data.message | File signed | |
| 39 | + And as user "signer1" |
| 40 | + And sending "get" to ocs "/apps/libresign/api/v1/file/validate/uuid/<FILE_UUID>" |
| 41 | + Then the response should have a status code 200 |
| 42 | + And the response should be a JSON array with the following mandatory values |
| 43 | + | key | value | |
| 44 | + | (jq).ocs.data.signers[0].signature_validation | {"id":1,"label":"Signature is valid."} | |
| 45 | + And the response should be a JSON array with the following mandatory values |
| 46 | + | key | value | |
| 47 | + | (jq).ocs.data.signers[0].timestamp.policy | 1.2.3.4.1 | |
| 48 | + And the response should be a JSON array with the following mandatory values |
| 49 | + | key | value | |
| 50 | + | (jq).ocs.data.signers[0].timestamp.serialNumber \|test("^[0-9]+$") | true | |
| 51 | + And the response should be a JSON array with the following mandatory values |
| 52 | + | key | value | |
| 53 | + | (jq).ocs.data.signers[0].timestamp.genTime \|test("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}") | true | |
| 54 | + And the response should be a JSON array with the following mandatory values |
| 55 | + | key | value | |
| 56 | + | (jq).ocs.data.signers[0].timestamp.cnHints.commonName | www.freetsa.org | |
| 57 | + | (jq).ocs.data.signers[0].timestamp.cnHints.countryName | DE | |
| 58 | + |
| 59 | + Scenario: TSA error handling - Invalid server |
| 60 | + Given run the command "config:app:set libresign tsa_url --value=https://invalid-tsa-server.example.com/tsr --type=string" with result code 0 |
| 61 | + And run the command "config:app:set libresign tsa_auth_type --value=none --type=string" with result code 0 |
| 62 | + And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods" |
| 63 | + | value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"clickToSign":{"enabled":true}},"signatureMethodEnabled":"clickToSign"}] | |
| 64 | + When sending "post" to ocs "/apps/libresign/api/v1/request-signature" |
| 65 | + | file | {"url":"<BASE_URL>/apps/libresign/develop/pdf"} | |
| 66 | + | users | [{"identify": {"account": "signer1"}}] | |
| 67 | + | name | TSA Error Test | |
| 68 | + And as user "signer1" |
| 69 | + And sending "get" to ocs "/apps/libresign/api/v1/file/list" |
| 70 | + And fetch field "(SIGN_UUID)ocs.data.data.0.signers.0.sign_uuid" from previous JSON response |
| 71 | + And sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/<SIGN_UUID>" |
| 72 | + | method | clickToSign | |
| 73 | + Then the response should have a status code 422 |
| 74 | + And the response should be a JSON array with the following mandatory values |
| 75 | + | key | value | |
| 76 | + | (jq).ocs.meta.status | failure | |
| 77 | + | (jq).ocs.meta.statuscode | 422 | |
| 78 | + And the response should be a JSON array with the following mandatory values |
| 79 | + | key | value | |
| 80 | + | (jq).ocs.data.action | 2000 | |
| 81 | + |
| 82 | + Scenario: Clean up TSA configuration after tests |
| 83 | + Given run the command "config:app:delete libresign tsa_url" with result code 0 |
| 84 | + And run the command "config:app:delete libresign tsa_policy_oid" with result code 0 |
| 85 | + And run the command "config:app:delete libresign tsa_auth_type" with result code 0 |
0 commit comments