[英]Simple example of restful web service Python and client basic authentication
[英]gRPC python client authentication example
服務器端,需要具備:
server_credentials = grpc.ssl_server_credentials(
((private_key, cert_chain),), root_cert, require_client_auth=True)
server.add_secure_port('%s:%d' % (ip, port), server_credentials)
root_cert
是用於驗證客戶端證書的根CA。 private_key
和cert_chain
將是服務器用於客戶端驗證的證書。
和客戶端:
creds = grpc.ssl_channel_credentials(
certificate_chain=cert_chain, private_key=cert_key, root_certificates=root_ca)
channel = grpc.secure_channel('%s:%d' % (hostname, port), creds)
其中root_ca
是用於驗證服務器證書鏈的根CA,而cert_chain
和cert_key
用於驗證客戶端。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.