Giter Club home page Giter Club logo

nullauthenticator's Introduction

DEPRECATED

NullAuthenticator was moved to JupyterHub Core in version 2.0.0. You can migrate to it by setting:

c.JupyterHub.authenticator_class = "null"

NullAuthenticator

PyPI

Null Authenticator for JupyterHub instances that should have no login mechanism, such as those that exclusively allow access via API token.

Installation

As prerequisites, Python 3.4+ and JupyterHub 0.8.0+ are required to use Null Authenticator.

To install nullauthenticator, enter in a terminal:

python3 -m pip install nullauthenticator

Usage

Enable null authenticator in jupyterhub_config.py:

c.JupyterHub.authenticator_class = 'nullauthenticator.NullAuthenticator'

Example

The examples directory of this repo demonstrates a token-only example with Null Authenticator which uses external user creation and authentication.

nullauthenticator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nullauthenticator's Issues

Will this work as an 'external' service in a kubernetes context?

@minrk ... thanks for putting this tool together.
I'm trying to use it in the following context, but having difficulties in getting it working properly.

I have my own app which authenticates against firebase using JWT tokens. It includes functionality requiring connecting to jupyterlab, and I wanted to avoid a user having to login twice to two separate systems and so the nullauthenticator fits my needs well, in that sense.

In my case, jupyterhub is using a similar set-up to the zero-to-jupyterhub-k8s and runs on Google's GKE infrastructure. I have been able to setup nbviewer and nbdime as external services to the hub in this context, but setting up nullauthenticator the same way is not working and I can't figure out why. This is my set-up as an external service in the jupyterhub_config.py:

c.JupyterHub.services = [{
            'name': 'login',
            'admin': True,
            'url': 'http://' + os.environ['LOGIN_SERVICE_HOST'] + ':' + os.environ['LOGIN_SERVICE_PORT'],
            'api_token': os.environ['LOGIN_JHUB_TOKEN']
        }]

I have also tried setting things up as an internal service, but that is somehow also failing.

c.JupyterHub.services = [{
            'name': 'login',
            'admin': True,
            'command': [sys.executable, '/srv/login-service.py'],
            'url': 'http://127.0.0.1:4202',
        }]

In an effort to get the internal service working, I have hard-coded the env variable lookup in the login-services.py directly, since it's easier this way than trying to pass them to the kubernetes environment, for now at least.

env = {'JUPYTERHUB_API_URL':'http://127.0.0.1:8081/hub/api', 'JUPYTERHUB_BASE_URL': 'http://myhubserver.com/hub/', 'JUPYTERHUB_SERVICE_URL': 'http://127.0.0.1:4202', 'JUPYTERHUB_API_TOKEN': 'some-fixed-token'}

I continue to get a combination of 403 and 302 errors.

[I 2018-02-18 19:54:02.463 JupyterHub app:1528] Hub API listening on http://0.0.0.0:8081/hub/
[I 2018-02-18 19:54:02.467 JupyterHub app:1538] Not starting proxy
[I 2018-02-18 19:54:02.467 JupyterHub app:1544] Starting managed service login at http://127.0.0.1:4202
[I 2018-02-18 19:54:02.468 JupyterHub service:266] Starting service 'login': ['/usr/bin/python3', '/srv/login-service.py']
[I 2018-02-18 19:54:02.475 JupyterHub service:109] Spawning /usr/bin/python3 /srv/login-service.py
[I 2018-02-18 19:54:02.911 JupyterHub app:1551] Adding external service nbdime at http://10.7.243.191:9000
[I 2018-02-18 19:54:03.049 JupyterHub app:1551] Adding external service nbviewer at http://10.7.247.171:8080
[I 2018-02-18 19:54:03.071 JupyterHub app:1581] JupyterHub is now running at http://10.7.xxx.xxx:80/
[W 2018-02-18 20:05:04.928 JupyterHub base:351] Failed login for unknown user
[W 2018-02-18 20:05:04.955 JupyterHub log:122] 403 GET /hub/login?next=%2Fhub%2Fuser%2Fmccoole%2F%3Ftoken%3Dsome-fixed-token (@10.4.0.1) 28.62ms
[I 2018-02-18 20:05:36.646 JupyterHub log:122] 302 GET / \u2192 /hub (@10.132.0.6) 0.70ms
[I 2018-02-18 20:05:36.959 JupyterHub log:122] 302 GET /hub \u2192 /hub/login (@10.132.0.6) 0.70ms
[W 2018-02-18 20:05:37.272 JupyterHub base:351] Failed login for unknown user
[W 2018-02-18 20:05:37.273 JupyterHub log:122] 403 GET /hub/login (@10.132.0.6) 1.84ms
[W 2018-02-18 20:05:37.898 JupyterHub log:122] 405 POST /q.php (@10.132.0.6) 1.46ms
[W 2018-02-18 20:05:38.521 JupyterHub log:122] 405 POST /s.php (@10.132.0.6) 1.43ms
[W 2018-02-18 20:05:39.144 JupyterHub log:122] 405 POST /wuwu11.php (@10.132.0.6) 1.43ms
[W 2018-02-18 20:05:39.766 JupyterHub log:122] 405 POST /slider.php (@10.132.0.6) 1.50ms
[W 2018-02-18 20:05:40.389 JupyterHub log:122] 405 POST /sheep.php (@10.132.0.6) 1.61ms
[W 2018-02-18 20:05:41.013 JupyterHub log:122] 405 POST /q.php (@10.132.0.6) 1.75ms
[W 2018-02-18 20:05:41.637 JupyterHub log:122] 405 POST /xx.php (@10.132.0.6) 1.51ms
[I 2018-02-18 20:07:00.796 JupyterHub log:122] 302 GET /hub/user/mccoole/?token=mccoole-token \u2192 /hub/login?next=%2Fhub%2Fuser%2Fmccoole%2F%3Ftoken%3Dsome-fixed-token (@10.4.0.1) 1.21ms
[W 2018-02-18 20:07:00.833 JupyterHub base:351] Failed login for unknown user
[W 2018-02-18 20:07:00.835 JupyterHub log:122] 403 GET /hub/login?next=%2Fhub%2Fuser%2Fmccoole%2F%3Ftoken%3Dsome-fixed-token (@10.4.0.1) 1.93ms

Looking at those logs above, none of them show the base url .. just the part /hub/login.... ... could it be that this base url part is not getting captured?

Does this solution somehow require that the port 4202 is exposed externally to the internet, or is it enough that it is just exposed internally within the kubernetes infrastructure? Could that be the reason it is failing ... even to redirect me to the login.html page?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.