From 4f71fe32c8d5e366f9ac50c05656855371fc1751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=9C=E4=BA=91?= Date: Wed, 15 Jun 2022 18:20:56 +0800 Subject: [PATCH] =?UTF-8?q?build(composer):=20=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=AD=BE=E5=90=8D=E7=9A=84=20bin=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李东云 --- .gitignore | 3 +++ bin/generate-cert | 23 +++++++++++++++++++++++ composer.json | 3 +++ 3 files changed, 29 insertions(+) create mode 100755 bin/generate-cert diff --git a/.gitignore b/.gitignore index b12c39b..c2939ff 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ composer.lock # IDE support .idea/ .vscode/ + +# cache +cert/ diff --git a/bin/generate-cert b/bin/generate-cert new file mode 100755 index 0000000..d5a92f0 --- /dev/null +++ b/bin/generate-cert @@ -0,0 +1,23 @@ +#!/bin/sh +# shellcheck disable=SC2039 + +echo -e '\033[44;34;5m=============================\033[0m' +#mkdir -p "$(pwd)"/cert && cd "$(pwd)"/cert || exit +echo 'Credentials directory created' +echo -e '\033[44;34;5m=============================\033[0m' +echo '' +#openssl req -new -x509 -nodes -sha256 -out saml.crt -keyout saml.pem && cd - || exit +echo '' +echo -e '\033[44;34;5m=============================\033[0m' +echo -e '\033[;31;1m🎉Congratulations!\033[0m' +echo 'Now you can found credentials in the following directory:' +echo -e "\033[;36;4m$(pwd)/cert/\033[0m" +echo '' +echo -e "Public key: \033[;35;4mcert/saml.crt\033[0m" +echo -e "Private key: \033[;35;4mcert/saml.pem\033[0m" +echo '' +echo -e '\033[34;1mNotice: If you cannot read saml.pem in IDE,\033[0m' +echo -e '\033[34;1myou can print it in commander directly with following command:\033[0m' +echo '' +echo -e '\033[5mcat ./cert/saml.pem\033[0m' +echo '' diff --git a/composer.json b/composer.json index 4f57400..77fadae 100644 --- a/composer.json +++ b/composer.json @@ -59,6 +59,9 @@ "config": "Singularity\\HyperfSaml\\ConfigProvider" } }, + "bin": [ + "bin/generate-cert" + ], "repositories": { "packagist": { "type": "composer",