~fkooman/vpn-user-portal

a305375f4d7c03df206fa5731d224f40d01dd592 — François Kooman 3 months ago 865f199
fix response error for missing/unauthorized profile, add InputValidation
1 files changed, 2 insertions(+), 2 deletions(-)

M src/VpnApiModule.php
M src/VpnApiModule.php => src/VpnApiModule.php +2 -2
@@ 128,10 128,10 @@ class VpnApiModule implements ServiceModuleInterface
                        }

                        if (!\in_array($requestedProfileId, $availableProfiles, true)) {
                            return new ApiErrorResponse('profile_config', 'profile not available or no permission');
                            return new JsonResponse(['error' => 'profile not available, or no permission'], 400);
                        }

                        $tcpOnly = 'on' === $request->optionalPostParameter('tcp_only');
                        $tcpOnly = 'on' === InputValidation::tcpOnly($request->optionalPostParameter('tcp_only'));
                        $vpnConfig = $this->getConfigOnly($requestedProfileId, $remoteStrategy, $tcpOnly);
                        $clientCertificate = $this->getCertificate($accessTokenInfo);
                        $vpnConfig .= "\n<cert>\n".$clientCertificate['certificate']."\n</cert>\n<key>\n".$clientCertificate['private_key']."\n</key>";