Skip to content

Commit

Permalink
Disable internal CKAN login configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
blagojabozinovski committed Feb 5, 2024
1 parent eada919 commit 0189c1a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ To install ckanext-keycloak:
Configuration settings to run the extension
```
ckanext.keycloak.server_url = link_to_keycloack_authentication_url
ckanext.keycloak.client_id = client_id
ckanext.keycloak.realm_name = realm_name
ckanext.keycloak.redirect_uri = redirect_url
ckanext.keycloak.client_secret_key = client_secret_key
ckanext.keycloak.button_style = google/azure (if empty it will have the default stile)
```
ckanext.keycloak.enable_ckan_internal_login = True or False
## Developer installation
Expand Down
7 changes: 7 additions & 0 deletions ckanext/keycloak/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,10 @@ def button_style():

return tk.config.get('ckanext.keycloak.button_style',
environ.get('CKANEXT__KEYCLOAK__BUTTON_STYLE'))


def enable_internal_login():

return tk.asbool(tk.config.get(
'ckanext.keycloak.enable_ckan_internal_login',
environ.get('CKANEXT__KEYCLOAK__CKAN_INTERNAL_LOGIN')))
1 change: 1 addition & 0 deletions ckanext/keycloak/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ def get_blueprint(self):
def get_helpers(self):
return {
'button_style': h.button_style,
'enable_internal_login': h.enable_internal_login,
}
8 changes: 6 additions & 2 deletions ckanext/keycloak/templates/user/snippets/login_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
{% else %}
<a class="btn btn-primary" href="{{ h.url_for('keycloak.sso') }}">{{ _('SSO') }}</a>
{% endif %}

<button class="btn btn-primary" type="submit">{{ _('Login') }}</button>

{% set enable_ckan_login = h.enable_internal_login() %}
{% if enable_ckan_login %}
<button class="btn btn-primary" type="submit">{{ _('Login') }}</button>
{% else%}
{% endif %}

{% endblock %}

0 comments on commit 0189c1a

Please sign in to comment.