Skip to content

Commit

Permalink
Fix extension variables
Browse files Browse the repository at this point in the history
  • Loading branch information
JGulic committed Mar 23, 2023
1 parent e5e0d12 commit cec5aae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ To install ckanext-keycloak:
Configuration settings to run the extension
```
ckan.sso.keycloak_url = link_to_keycloack_authentication_url
ckan.sso.keycloak_realm = realm_name
ckan.sso.keycloak_client_id = client_id
ckan.sso.redirect_uri = redirect_url
ckanext.keycloak_url = link_to_keycloack_authentication_url
ckanext.keycloak.client_id = realm_name
ckanext.keycloak.realm_name = client_id
ckanext.keycloak.redirect_uri = redirect_url
ckanext.keycloak.client_secret_key = client_secret_key
```
## Developer installation
Expand Down
16 changes: 9 additions & 7 deletions ckanext/keycloak/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#

import logging
from flask import Blueprint, session
from ckan.plugins import toolkit as tk
Expand All @@ -11,14 +9,18 @@
import ckanext.keycloak.helpers as helpers
from urllib.parse import urlencode
import ckan.lib.dictization as dictization
from os import environ

log = logging.getLogger(__name__)

keycloak = Blueprint('keycloak', __name__, url_prefix='/user')
server_url = "https://auth.sproutopencontent.com/"
client_id = 'sprout-client'
realm_name = 'sprout'
redirect_uri = 'http://localhost:5000/user/sso_login'
client_secret_key = 'Y3Sn2ilmQWP9zaS8SwNqbKbVE6Q9yUIu'


server_url = tk.config.get('ckanext.keycloak.server_url', environ.get('CKANEXT__KEYCLOAK__SERVER_URL'))
client_id = tk.config.get('ckanext.keycloak.client_id', environ.get('CKANEXT__KEYCLOAK__CLIENT_ID'))
realm_name = tk.config.get('ckanext.keycloak.realm_name', environ.get('CKANEXT__KEYCLOAK__REALM_NAME'))
redirect_uri = tk.config.get('ckanext.keycloak.redirect_uri', environ.get('CKANEXT__KEYCLOAK__REDIRECT_URI'))
client_secret_key = tk.config.get('ckanext.keycloak.client_secret_key', environ.get('CKANEXT__KEYCLOAK__CLIENT_SECRET_KEY'))

client = KeycloakClient(server_url, client_id, realm_name, client_secret_key)

Expand Down

0 comments on commit cec5aae

Please sign in to comment.