Skip to content

Library design going forward - high and low level API expected? #60

@sergei-maertens

Description

@sergei-maertens

First of all - thanks for this library, the demo project is really cool to test out the various features!

We're looking to integrate kagi in some serious projects, and one of the things I'm noticing with (most) MFA-related libraries is that they're either quite invasive or make it too easy to shoot yourself in the foot.

So, I'm hoping that kagi takes an approach where you have some drop-in "recipes"/functionality (which would be the current situation, like the kagi LoginView and then updating settings to point to the kagi login URL), which would serve the majority of package users probably, and then some lower-level tooling to wire things up yourself if need be.

For example, we need a way to be able to enforce MFA only in the admin (middleware checking the MFA auth status if request.path startswith reverse("admin:index")?) and redirect people to the setup/configuration page if that's not the case. BUT, since we also support OIDC login which has their own MFA setup, it should also be possible to disable this admin-mfa-enforcement.

Doing these checks whether MFA is required or not, whether the user has that enabled or not (I see some request.session stuff happening in your LoginView) seem to me as viable candidates for public utilities used in your recipes and exposed/documented for people using low-level interfaces.

Is this something you would be open to? I'm fairly hopeful we could contribute this from Maykin Media.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions