问题
I'd like to control certificate popup windows manually. For example, if an user wanna login with client-side-certificate, I prompts a certificate selection window; If he wanna login with username/password. System let him in without checking his certificate.
回答1:
There are no standard APIs (or non-standard that I'm aware of) for controlling this with JavaScript or something similar.
The only solution I can think of is to have two webservers.
- One for showing a web page that links to either the login form or the client certificate, and this server also implements the login form.
- One that requires the user to specify a client certificate.
You could solve this using the same wildcard certificate for both servers and having them on different sub-domains so that you can actually back this setup by 2 different servers (IP addresses).
You can use the same actual physical server, and do "virtual host" dispatching based on the IP, and you can use the same wildcard SSL certificate for both.
The reason you need different servers is that the prompt for an SSL client certificate is triggered at the SSL handshake level, so you can't use name based virtual hosts, you need 2 actual servers to do it.
来源:https://stackoverflow.com/questions/40619577/is-there-a-way-to-control-browsers-certificate-selection-popup-manually