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

Page and Path overloads #50

Merged
merged 2 commits into from
Dec 3, 2021
Merged

Conversation

codemation
Copy link
Owner

Description

This PR implements default html page overloading, & client default_login_path overrides.

Page Overloads

It is possible to overload the existing login, register, activation, not_found, and forbidden pages using the page specific "overloader". Just like routers, this should be done after an EasyAuthClient is created.

Not Found - 404

from easyauth.pages import NotFoundPage

@NotFoundPage.mark()
def custom_not_found_page():
    return "Custom 404 Page"

Forbidden Page - 403

from easyauth.pages import ForbiddenPage

@ForbiddenPage.mark()
def not_allowed_page():
    return "Custom 404 Page"

Login Page & 401

from easyauth.pages import LoginPage

@LoginPage.mark()
def custom_login_page():
    return "Custom Login Page"

Register Page

from easyauth.pages import RegisterPage

@RegisterPage.mark()
def custom_register_page():
    return "Custom Register Page"

Activation Page

from easyauth.pages import ActivationPage

@ActivationPage.mark()
def custom_activation_page():
    return "Custom Login Page"

Path Overloads

The default /login and 401 redirect path can be overloaded by setting the default_login_path on EasyAuthClient.create().

    server.auth = await EasyAuthClient.create(
        server,
        token_server='0.0.0.0',
        token_server_port=8090,
        auth_secret='abcd1234',
        default_permissions={'groups': ['users']},
        default_login_path='/v1/internal/login'
    )

Codemation added 2 commits December 4, 2021 00:10
…tom login, register, activation, 404, 403 pages, added new 'default_login_path' parameter to 'EasyAuthClient' to allow default '/login' and 401 path overrides
@codemation codemation merged commit cca45b0 into main Dec 3, 2021
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

Successfully merging this pull request may close these issues.

1 participant