Skip to content

Commit 49682d7

Browse files
author
wesuuu
committed
Added login_url method to SAMLAuthenticator
1 parent 2c0480b commit 49682d7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

jupyterhub_saml_auth/authenticator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from jupyterhub.auth import Authenticator
2+
from jupyterhub.utils import url_path_join
23
from traitlets import Unicode, validate, Set, Callable
34
import os
45

@@ -73,6 +74,9 @@ def _settings_files_exist(self, path):
7374
in saml settings path. Path = {path}, \
7475
contents = {dir_contents}')
7576

77+
def login_url(self, base_url):
78+
return url_path_join(base_url, 'saml_login')
79+
7680
def authenticate(self, handler, data):
7781
return data['name']
7882

test/unit/test_authenticator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from jupyterhub_saml_auth.authenticator import SAMLAuthenticator
2+
3+
4+
def test_login_url_sets():
5+
samlauth = SAMLAuthenticator()
6+
assert '/hub/saml_login' == samlauth.login_url('/hub')

0 commit comments

Comments
 (0)