Skip to content

Commit

Permalink
Add workaround for custom HTTPS certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted committed Mar 6, 2024
1 parent 1a7fa47 commit 76a97bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions keycloak_oauth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
import ssl
from typing import Any
import pydantic
from authlib.common.security import generate_token
Expand Down Expand Up @@ -37,6 +38,11 @@ def __init__(

oauth = OAuth()

# HACK: load custom certificate including default certifi cacert chain
if verify := client_kwargs.get("verify"):
ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23, verify=verify)
client_kwargs["verify"] = ssl_context

oauth.register(
name="keycloak",
# client_id and client_secret are created in keycloak
Expand Down

0 comments on commit 76a97bd

Please sign in to comment.