public function configureAction(Request $request)
    {
        if ($this->get('tenside.status')->isTensideConfigured()) {
            throw new NotAcceptableHttpException('Already configured.');
        }
        $inputData = new JsonArray($request->getContent());

        $secret = bin2hex(random_bytes(40));
        if ($inputData->has('credentials/secret')) {
            $secret = $inputData->get('credentials/secret');
        }

        // Add tenside configuration.
        $tensideConfig = $this->get('tenside.config');
        $tensideConfig->set('secret', $secret);

        if ($inputData->has('configuration')) {
            $this->handleConfiguration($inputData->get('configuration', true));
        }
        $user = $this->createUser($inputData->get('credentials/username'), $inputData->get('credentials/password'));

        return new JsonResponse(
            [
                'status' => 'OK',
                'token'  => $this->get('tenside.jwt_authenticator')->getTokenForData($user)
            ],
            JsonResponse::HTTP_CREATED
        );
    }