Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a login page with authentication #33

Open
cloud-rocket opened this issue Jan 11, 2021 · 9 comments
Open

Add a login page with authentication #33

cloud-rocket opened this issue Jan 11, 2021 · 9 comments

Comments

@cloud-rocket
Copy link

Is your feature request related to a problem? Please describe.
awesome-panel allows building real web apps with Python - which is a huge deal! Any modern app usually requires a login/authentication mechanism.

Describe the solution you'd like
Add optional support for creating a login page with username and password / Oauth2

@MarcSkovMadsen
Copy link
Collaborator

Good idea. Thanks

@MarcSkovMadsen
Copy link
Collaborator

Just for reference the OAuth is described here https://panel.holoviz.org/user_guide/Authentication.html. I've not tried using it yet.

@cloud-rocket
Copy link
Author

I am trying to enable OAuth2 authentication (based on Panel docs), but aside from redirecting to /login it's not working. Bokeh is still popping out the message:

INFO:bokeh.server.tornado:User authentication hooks NOT provided (default user enabled)

Can suggest where should I continue digging?
Thanks

@cloud-rocket
Copy link
Author

Ok, have some progress - you should replace:

in modifications/_server.py you should replace:

    if config.oauth_provider:
        from panel.auth import OAuthProvider

        opts["auth_provider"] = OAuthProvider()
    if oauth_provider:
        config.oauth_provider = oauth_provider

with

    if oauth_provider:
        from panel.auth import OAuthProvider
        config.oauth_provider = oauth_provider
        opts["auth_provider"] = OAuthProvider()

Otherwise, the code is meaningless

@cloud-rocket
Copy link
Author

The whole part of overriding server.py is highly problematic (in terms of panel upgrades and compatibility).... Maybe it makes sense to make the fixes more generic and request to merge them into the panel core?

@cloud-rocket
Copy link
Author

I tested the setup with Auth0 and it works!

Here is an Auth0 implementation I added - holoviz/panel#1934

I can also create a PR for my changes in your code if you want

@MarcSkovMadsen
Copy link
Collaborator

MarcSkovMadsen commented Jan 24, 2021

Hi @cloud-rocket

Regarding the Auth0 the best thing would to get it released in Panel. If I could get a contribution of a log in page that uses the Panel functionality, then we could showcase to Philipp that it works, is used and needed. That would help him I think get it into Panel I think. The alternative of contributing the implementation here and removing it when it's released with Panel is also fine with me. What do you think? I have close to zero experience with auth implementations - but it's very important and need to learn to do it :-)

Regarding the custom server implementation I agree it's problematic. And it is on my todo list to contribute the improvement to Panel. I will put that at the top of my todo list now. Thanks for reminding me.

@MarcSkovMadsen
Copy link
Collaborator

Hi @cloud-rocket

I've contributed a PR to Panel for the get_server function.

Please comment or upvote the FR. That might help get the improvements in. Thanks.

@cloud-rocket
Copy link
Author

Hi @cloud-rocket

I've contributed a PR to Panel for the get_server function.

Please comment or upvote the FR. That might help get the improvements in. Thanks.

Cool! I'll take a look.

Auth0 is merged to Panel also.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants