szabacsik / snowflake-json-web-token
雪花 JSON Web Token
1.0.1
2022-12-21 15:57 UTC
Requires
- php: ^8.0
- ext-mbstring: *
- ext-openssl: *
- firebase/php-jwt: *
Requires (Dev)
README
用法
composer require szabacsik/snowflake-json-web-token
$token = new \Szabacsik\SnowflakeJsonWebToken\Token(); $token ->setAccount('account') ->setUsername('username') ->setPrivateKeyPath('/path/to/your/private_key.p8') ->setPrivateKeyPassphrase('password') ->setIssuedAt(time()) ->setExpirationTime(time() + 3600); echo $token->generate();
创建私钥
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out snowflake_rsa_private_key.p8
创建公钥
openssl rsa -in snowflake_rsa_private_key.p8 -pubout -out snowflake_rsa_public_key.pub
将您的公钥设置到雪花用户
alter user {{YOUR_USERNAME}} set rsa_public_key='from snowflake_rsa_public_key.pub MIIBIjANBgkqhkiG...';
提交测试请求以执行 SQL 语句
./tests/EndToEndTest.php
链接
https://docs.snowflake.com/en/developer-guide/sql-api/index.html
https://api.developers.snowflake.com/
https://docs.snowflake.com/en/developer-guide/sql-api/authenticating.html#label-sql-api-authenticating-key-pair
https://datatracker.ietf.org/doc/html/rfc7519
https://docs.snowflake.com/en/developer-guide/sql-api/submitting-requests.html
https://docs.snowflake.com/en/developer-guide/sql-api/submitting-requests.html#example-of-a-request
https://docs.snowflake.com/en/developer-guide/sql-api/authenticating.html#using-key-pair-authentication
https://streamsets.com/blog/snowflake-key-pair-authentication/