-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get client certificate properties #3435
Comments
GitMate.io thinks the contributor most likely able to help you is @asvetlov. Possibly related issues are #2547 (Drop deprecated request.GET property), #1309 (Client Tracing), #2849 (Getting Connection closed with aiohttp client), #2865 (Improve client timeouts), and #1661 (Client exceptions refactoring). |
Use E.g., |
That is not be working. Here is the example of both server and client. server.py
client.py
|
Could you please save my time and describe what doesn't work? |
Works in my use case, which is retrieving a client's certificate (TLS mutual auth). |
Should this work on the client side to get the server's SSL certificate details also? EDIT: figured it out. response.connection.transport.get_extra_info("peercert") works. |
Long story short
I am running a aiohttp server using the web application module. To perform mutual TLS, I need to authenticate and verify the client certificates along with a few properties(client id) inside the certificate. I am unable to retrieve the client's certificate through the request. They seem to be not present in the request object nor there is a client object I can pull these details from. Following is an example of who this can be done in Flask.
https://www.ajg.id.au/2018/01/01/mutual-tls-with-python-flask-and-werkzeug/
Is there a mechanism to do the same with aiohttp?
Expected behaviour
Ability to pull client certificate details on the server side.
Actual behaviour
Currently there are no client certificate details in the request
Steps to reproduce
async def middleware(self, request, handler):
pass
cert = "cert.pem"
key = "key.pem"
app = web.Application(middlewares=[middleware])
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain(certfile=cert, keyfile=key)
web.run_app(app, port=443, ssl_context=ssl_context)
The text was updated successfully, but these errors were encountered: