| @@ 69-92 (lines=24) @@ | ||
| 66 | $this->service->addBeforeHook('auth', $bearerAuthentication); |
|
| 67 | } |
|
| 68 | ||
| 69 | public function testGenerateCert() |
|
| 70 | { |
|
| 71 | $this->assertSame( |
|
| 72 | [ |
|
| 73 | 'data' => [ |
|
| 74 | 'add_client_certificate' => [ |
|
| 75 | 'certificate' => 'ClientCert for random_1', |
|
| 76 | 'private_key' => 'ClientKey for random_1', |
|
| 77 | 'valid_from' => 1234567890, |
|
| 78 | 'valid_to' => 2345678901, |
|
| 79 | 'ta' => 'Test_Ta_Key', |
|
| 80 | 'ca' => 'Ca', |
|
| 81 | ], |
|
| 82 | ], |
|
| 83 | ], |
|
| 84 | $this->makeRequest( |
|
| 85 | ['vpn-user-portal', 'abcdef'], |
|
| 86 | 'POST', |
|
| 87 | '/add_client_certificate', |
|
| 88 | [], |
|
| 89 | ['user_id' => 'foo', 'display_name' => 'bar'] |
|
| 90 | ) |
|
| 91 | ); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testGenerateServerCert() |
|
| 95 | { |
|
| @@ 94-117 (lines=24) @@ | ||
| 91 | ); |
|
| 92 | } |
|
| 93 | ||
| 94 | public function testGenerateServerCert() |
|
| 95 | { |
|
| 96 | $this->assertSame( |
|
| 97 | [ |
|
| 98 | 'data' => [ |
|
| 99 | 'add_server_certificate' => [ |
|
| 100 | 'certificate' => 'ServerCert for vpn.example', |
|
| 101 | 'private_key' => 'ServerCert for vpn.example', |
|
| 102 | 'valid_from' => 1234567890, |
|
| 103 | 'valid_to' => 2345678901, |
|
| 104 | 'ta' => 'Test_Ta_Key', |
|
| 105 | 'ca' => 'Ca', |
|
| 106 | ], |
|
| 107 | ], |
|
| 108 | ], |
|
| 109 | $this->makeRequest( |
|
| 110 | ['vpn-server-node', 'aabbcc'], |
|
| 111 | 'POST', |
|
| 112 | '/add_server_certificate', |
|
| 113 | [], |
|
| 114 | ['common_name' => 'vpn.example'] |
|
| 115 | ) |
|
| 116 | ); |
|
| 117 | } |
|
| 118 | ||
| 119 | private function makeRequest(array $basicAuth, $requestMethod, $pathInfo, array $getData = [], array $postData = []) |
|
| 120 | { |
|