[Update] Merge

This commit is contained in:
ibuler
2019-02-28 18:24:52 +08:00
7 changed files with 12 additions and 11 deletions

View File

@@ -16,6 +16,8 @@ class LDAPAuthorizationBackend(LDAPBackend):
"""
def authenticate(self, request=None, username=None, password=None, **kwargs):
if not username:
return None
ldap_user = LDAPUser(self, username=username.strip(), request=request)
user = self.authenticate_ldap_user(ldap_user, password)
return user

View File

@@ -39,10 +39,6 @@ class Client(object):
self.openid_connect_client = self.new_openid_connect_client()
def new_realm(self):
"""
:param authentication.openid.models.Realm realm:
:return keycloak.realm.Realm:
"""
return KeycloakRealm(
server_url=self.server_url,
realm_name=self.realm_name,
@@ -77,7 +73,7 @@ class Client(object):
:param str username: authentication username
:param str password: authentication password
:return: authentication.models.OpenIDTokenProfile
:return: OpenIDTokenProfile
"""
token_response = self.openid_client.token(
username=username, password=password
@@ -94,7 +90,7 @@ class Client(object):
:param str code: authentication code
:param str redirect_uri:
:rtype: authentication.models.OpenIDTokenProfile
:rtype: OpenIDTokenProfile
"""
token_response = self.openid_connect_client.authorization_code(
@@ -115,7 +111,7 @@ class Client(object):
- refresh_expires_in
:param dict token_response:
:rtype: authentication.openid.models.OpenIDTokenProfile
:rtype: OpenIDTokenProfile
"""
userinfo = self.openid_connect_client.userinfo(

View File

@@ -26,7 +26,7 @@ __all__ = ['OpenIDLoginView', 'OpenIDLoginCompleteView']
class OpenIDLoginView(RedirectView):
def get_redirect_url(self, *args, **kwargs):
redirect_uri = settings.BASE_SITE_URL + settings.LOGIN_COMPLETE_URL
redirect_uri = settings.BASE_SITE_URL + str(settings.LOGIN_COMPLETE_URL)
nonce = Nonce(
redirect_uri=redirect_uri,
next_path=self.request.GET.get('next')

View File

@@ -1,5 +1,6 @@
# coding:utf-8
#
from __future__ import absolute_import
from django.urls import path

View File

@@ -1,6 +1,8 @@
# coding:utf-8
#
from __future__ import absolute_import
from django.urls import path, include
from .. import views