Merge pull request #3344 from deepak1556/certificate_verifier_api_patch

session: api to allow handling certificate verification
This commit is contained in:
Cheng Zhao 2015-11-17 18:53:35 +08:00
commit 24f573eceb
12 changed files with 436 additions and 17 deletions

View file

@ -139,8 +139,8 @@ Returns:
* `webContents` [WebContents](web-contents.md)
* `url` URL
* `certificateList` [Objects]
* `data` PEM encoded data
* `issuerName` Issuer's Common Name
* `data` Buffer - PEM encoded data
* `issuerName` String - Issuer's Common Name
* `callback` Function
Emitted when a client certificate is requested.

View file

@ -34,6 +34,30 @@ session.on('will-download', function(event, item, webContents) {
});
```
### Event: 'verify-certificate'
* `event` Event
* `hostname` String
* `certificate` Object
* `data` Buffer - PEM encoded data
* `issuerName` String
* `callback` Function
Fired whenever a server certificate verification is requested by the
network layer with `hostname`, `certificate` and `callback`.
`callback` should be called with a boolean response to
indicate continuation or cancellation of the request.
```js
session.on('verify-certificate', function(event, hostname, certificate, callback) {
if (hostname == "github.com") {
// verification logic
callback(true);
}
callback(false);
});
```
## Methods
The `session` object has the following methods: