nicklasw / bankid-sdk
BankID SDK API客户端
1.1.0
2019-01-04 09:36 UTC
Requires
- php: ^7.1
- ext-curl: *
- ext-json: *
- doctrine/annotations: ^1.6
- guzzlehttp/guzzle: ^6.3
- tebru/gson-php: ^0.6.2
Requires (Dev)
- phan/phan: dev-master
- phpunit/phpunit: ^7.3
- squizlabs/php_codesniffer: ^3.3
- symfony/intl: ^4.1
- symfony/validator: ^4.1
This package is not auto-updated.
Last update: 2024-09-21 16:38:35 UTC
README
一个作为RP(依赖方)提供BankID服务的SDK。支持最新v5功能。
安装
可以通过composer
安装此库
composer require nicklasw/bankid-sdk
功能
- 支持所有v5功能
- 支持异步和并行请求
示例
发起认证请求
$client = new Client(new Config(<CERTFICATE>)); $authenticationResponse = $client->authenticate(new AuthenticationPayload(<PERSONAL NUMBER>, <IP ADDRESS>)); if (!$authenticationResponse->isSuccess()) { var_dump($authenticationResponse->getErrorCode(), $authenticationResponse->getDetails()); return; } $collectResponse = $authenticationResponse->collect();
执行并行请求
$client = new ClientAsynchronous(new Config(<CERTFICATE>)); $promises[] = $client->authenticate(new AuthenticationPayload(<PERSONAL NUMBER>, <IP ADDRESS>)); $promises[] = $client->authenticate(new AuthenticationPayload(<PERSONAL NUMBER>, <IP ADDRESS>)); // Parallel requests, authenticate users foreach (unwrap($promises) as $result) { /** * @var AuthenticationResponse $result */ var_dump($result->isSuccess()); }
证书
只有拥有有效SSL客户端证书的RP才能访问Web服务API。RP证书是从RP购买的BankID服务的银行获得的。
生成PEM证书
openssl pkcs12 -in <filename>.pfx -out <cert>.pem -nodes
Docker
make && make bash
单元测试
composer run test
贡献
- Fork它!
- 创建你的功能分支:
git checkout -b my-new-feature
- 提交你的更改:
git commit -am '关于你新功能的有用信息'
- 推送到分支:
git push origin my-new-feature
- 提交pull请求