Skip to content
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

How do you use the client when Keycloak is running over https #76

Open
kapadiup opened this issue Apr 15, 2020 · 4 comments
Open

How do you use the client when Keycloak is running over https #76

kapadiup opened this issue Apr 15, 2020 · 4 comments

Comments

@kapadiup
Copy link

When I run Keycloak in SSL mode when I try to use the client I don't see an option of passing in any certificates. When I try the https url anyways for keycloak I am getting a handshake error when I try to use KeycloakOpenID.

SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed'

@gianfabiopezzolla
Copy link

You have found some solutions for this?

@EvandoBlanco
Copy link

@kapadiup @sagolab

I was recently able to resolve this. I don't have the code in front of me, so some variable names may be wrong. But you can add a certificate path directly to the requests.Session like this:

connection = keycloak_client._connection
connection._s.cert = "/path/to/certificate"
keycloak_client._connection = connection

I hope this helps.

@lokeish
Copy link

lokeish commented Feb 16, 2023

There is no such method connection._s.cert, can you help with exact code snippet.

@a-n-t-h-o-n-y
Copy link

It looks like the verify constructor parameter of KeycloakOpenID, KeycloakAdmin and KeycloakOpenIDConnection are passed directly to the requests.Session calls, so it can be a certificate path. The python-keycloak docs could be more informative:

:param verify: True if want check connection SSL
:type verify: bool

The following works for me:

connection = KeycloakOpenIDConnection(
    server_url="...",
    username="...",
    password="...",
    realm_name="...",
    verify="/path/to/cert.pem",
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants