Skip to content

Commit aa73ff8

Browse files
author
wesuuu
committed
Updated & refactored
1 parent 1165831 commit aa73ff8

File tree

5 files changed

+33
-6
lines changed

5 files changed

+33
-6
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Jupyterhub SAML Auth
22

3+
[![image](https://badge.fury.io/py/jupyterhub-saml-auth.svg)](https://pypi.org/project/jupyterhub-saml-auth/)
4+
35
Authenticate your Jupyterhub users using SAML. This authenticator uses OneLogin's [python3-saml](https://github.com/onelogin/python3-saml) package as a backend API for handling SAML authentication.
46

57
## Installation
@@ -33,7 +35,7 @@ c.SAMLAuthenticator.session_cookie_names = {'PHPSESSIDIDP', 'SimpleSAMLAuthToken
3335
c.SAMLAuthenticator.extract_username = extract_username
3436

3537
# register the SAML authenticator with jupyterhub
36-
c.JupyterHub.authenticator_class = 'jupyterhub_saml_auth.authenticator.SAMLAuthenticator'
38+
c.JupyterHub.authenticator_class = 'jupyterhub_saml_auth.SAMLAuthenticator'
3739
```
3840

3941
## Development

jupyterhub_saml_auth/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__version__ = '0.1.0'
1+
__version__ = '0.1.1'
2+
3+
from .authenticator import SAMLAuthenticator

jupyterhub_saml_auth/authenticator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def configure_handlers(self):
8181
self.metadata_handler.saml_settings_path = self.saml_settings_path
8282
self.acs_handler.saml_settings_path = self.saml_settings_path
8383
self.logout_handler.saml_settings = self.saml_settings_path
84-
self.logout_handler.session_cookie_names = self.session_cookie_names
8584

85+
self.logout_handler.session_cookie_names = self.session_cookie_names
8686
self.acs_handler.extract_username = self.extract_username
8787

8888
def get_handlers(self, app):

setup.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@
44
import os.path
55

66

7-
# https://packaging.python.org/guides/single-sourcing-package-version/
87
def read(rel_path):
98
here = os.path.abspath(os.path.dirname(__file__))
109
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
1110
return fp.read()
1211

1312

1413
def get_version(rel_path):
14+
"""https://packaging.python.org/guides/single-sourcing-package-version/
15+
16+
Args:
17+
rel_path (str): relative path of init file with __version__
18+
19+
Raises:
20+
RuntimeError: wrong path
21+
22+
Returns:
23+
str: version
24+
"""
1525
for line in read(rel_path).splitlines():
1626
if line.startswith('__version__'):
1727
delim = '"' if '"' in line else "'"
@@ -20,10 +30,23 @@ def get_version(rel_path):
2030
raise RuntimeError("Unable to find version string.")
2131

2232

33+
def get_description():
34+
"""https://packaging.python.org/guides/making-a-pypi-friendly-readme/
35+
36+
Returns:
37+
str: README file
38+
"""
39+
this_dir = os.path.abspath(os.path.dirname(__file__))
40+
with open(os.path.join(this_dir, 'README.md'), encoding='utf-8') as f:
41+
long_description = f.read()
42+
return long_description
43+
44+
2345
setup(name='jupyterhub_saml_auth',
2446
version=get_version('jupyterhub_saml_auth/__init__.py'),
2547
python_requires='>=3.7.0',
26-
description='Authenticate your Jupyterhub users using SAML.',
48+
long_description=get_description(),
49+
long_description_content_type='text/markdown',
2750
author='Wesley Uykimpang',
2851
url='https://github.com/ucsd-ets/jupyterhub-saml-auth',
2952
packages=find_packages(),

test/jupyterhub_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def extract_username(acs_handler, attributes):
1414
c.SAMLAuthenticator.session_cookie_names = {'PHPSESSIDIDP', 'SimpleSAMLAuthTokenIdp'}
1515
c.SAMLAuthenticator.extract_username = extract_username
1616

17-
c.JupyterHub.authenticator_class = 'jupyterhub_saml_auth.authenticator.SAMLAuthenticator'
17+
c.JupyterHub.authenticator_class = 'jupyterhub_saml_auth.SAMLAuthenticator'
1818

1919

2020
def pre_spawn_hook(spawner):

0 commit comments

Comments
 (0)