Comments (6)
Latest version works well, with the extraConfig
added. I'll do further testing with non default user names, but this issue has been solved. Many thanks!
from ltiauthenticator.
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋
Welcome to the Jupyter community! 🎉
from ltiauthenticator.
Thanks for reporting this! Can you try LTI11Authenticator
rather than LTIAuthenticator
from ltiauthenticator.
Changing the configuration to
config:
LTI11Authenticator:
consumers: {
"aaaaaaaaaaa": "bbbbbbbbbbbb"
}
JupyterHub:
authenticator_class: ltiauthenticator.LTI11Authenticator
lead to the log message
Bad config encountered during initialization: The 'authenticator_class' trait of <jupyterhub.app.JupyterHub object at 0x7fceb42ca1c0>
instance must be a type, but 'ltiauthenticator.LTI11Authenticator' could not be imported
I found in init.py that the name exposed is still LTIAuthenticator
from ltiauthenticator.lti11.auth import LTI11Authenticator as LTIAuthenticator
I changed this to ... as LTI11Authenticator
. The auth process now passes. I run into another error:
custom_canvas_user_id did not match any of the launch request arguments
I have to investigate if this is a configuration issue on my side or a bug, not falling back to the old default user_id
. But it has certainly nothing to do with this issue.
from ltiauthenticator.
@BenGig thanks for reporting this error. I will try to replicate this issue soon. In the meantime, would you happen to have a copy of the request from the JupyterHub logs?
from ltiauthenticator.
General Comments
LTIAuthenticator Alias
@BenGig I did some preliminary testing. It seems that this error is related specifically to the K8s configuration. The Tests section below demonstrates how we can still use the LTIAuthenticator
alias with the more standard jupyterhub/jupyterhub:1.4.2
image that allows local testing with a docker container.
As a workaround, what you could do is add an extraConfig
section to your custom config to dynamically import the LTIAuthenticator
class and assign it to the authenticator_class
configurable like so:
...
extraConfig:
myAuthConfig: |
from ltiauthenticator import LTIAuthenticator
c.JupyterHub.authenticator_class = LTIAuthenticator
...
@yuvipanda wouldn't we have to add an entry point to the setup so that the K8s version supports these custom entry points?
Error with canvas_custom_user_id
It looks to me like this is a bug. The exception is raised before falling back to the custom user_id
, so will send a PR to fix this bug and update tests.
Tests
- Pull the
jupyterhub/jupyterhub:1.4.2
image:
docker pull jupyterhub/jupyterhub:1.4.2
- Run the image and exec into it:
docker run -it --rm -p 8000:8000 jupyterhub/jupyterhub:1.4.2 /bin/bash
- Install the
ltiauthenticator
package:
cd /tmp
git clone https://github.com/jupyterhub/ltiauthenticator
cd ltiauthenticator
pip install .
- Open a Python shell and test the import with the LTIAuthenticator alias:
...
Successfully built jupyterhub-ltiauthenticator
Installing collected packages: escapism, jupyterhub-ltiauthenticator
Successfully installed escapism-1.0.1 jupyterhub-ltiauthenticator-1.0.1.dev0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@5ed70fb64fee:/tmp/ltiauthenticator# python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ltiauthenticator import LTIAuthenticator
>>>
root@5ed70fb64fee:/tmp/ltiauthenticator#
- Start the JupyterHub service with a standalone docker container with a custom
jupyterhub_config.py
using the import alias:
""" Configuration file for jupyterhub. This version is used primarily for testing. """
# Set port and IP
c.JupyterHub.ip = "0.0.0.0"
c.JupyterHub.port = 8000
# Set log level
c.Application.log_level = "DEBUG"
# Header settings for iFrame and SameSite
c.JupyterHub.tornado_settings = {
"headers": {"Content-Security-Policy": "frame-ancestors 'self' *"},
"cookie_options": {"SameSite": "None", "Secure": True},
}
# Set the authenticator
c.JupyterHub.authenticator_class = 'ltiauthenticator.LTIAuthenticator'
- Verify that the authenticator class is using the
LTI11Authenticator
class by checking the JuptyterHub logs:
root@5ed70fb64fee:/tmp/ltiauthenticator# jupyterhub --config=jupyterhub_config.py
[I 2021-07-24 03:00:12.206 JupyterHub app:2459] Running JupyterHub version 1.4.2
[I 2021-07-24 03:00:12.207 JupyterHub app:2489] Using Authenticator: ltiauthenticator.lti11.auth.LTI11Authenticator
[I 2021-07-24 03:00:12.207 JupyterHub app:2489] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-1.4.2
from ltiauthenticator.
Related Issues (20)
- Is LTI13Authenticator specific to IllumiDesk? HOT 3
- 2FA required - jgwerner temporarily removed as a maintainer HOT 2
- LTI1.1 appears to fail with z2jh helm chart version 2.0.0 HOT 23
- Improve testing by starting up an LTI 1.3 endpoint in the CI system HOT 3
- Moodle LTI 1.3 support and guidelines HOT 14
- LTI13Authenticator does not set required routes HOT 4
- LTI13 - Ensure we can defend against replay attacks HOT 12
- feat(lti13) Allow `username_key` to be located inside the `custom` claim HOT 1
- LTI 1.1 - OAuth Parameter `oauth_callback` should be optional HOT 5
- Allow multiple LTI client IDs HOT 8
- Document danger of user name collisions HOT 1
- Do we really need to depend on oauthenticator? HOT 3
- "403 : Forbidden '_xsrf' argument missing from POST" with JupyterHub 4.0.0 HOT 12
- "Audience doesn't match" error if client_id is a string, not an iterable of strings HOT 3
- issue with importing LTI13Authenticator HOT 3
- setup.py missing in ltiauthenticator1.6.1 HOT 2
- Build fails with error metadata-generation-failed
- feat(lti13) Username calculation HOT 1
- The token is not yet valid (iat) - lti1.3 HOT 2
- Urgent: cut a beta release to help test #91? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ltiauthenticator.