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

Update the introiduction section to add Flask-Basicauth example #2589

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

howiezhao
Copy link

This PR adds an example of integrating Flask-Basicauth in the Introduction section of the documentation.

Copy link
Contributor

@samuelhwilliams samuelhwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we perhaps do this as a working example in the examples/ directory and point to that? This snippet implies a few things already exist (app, Post, db) - and it'd be nice to just be able to see a functioning example straight away.

@howiezhao
Copy link
Author

Could we perhaps do this as a working example in the examples/ directory and point to that? This snippet implies a few things already exist (app, Post, db) - and it'd be nice to just be able to see a functioning example straight away.

Hi @samuelhwilliams Thank you for your reply. The reason why I did not put it in the examples/ is that I think this example is very simple. Its core code is only the following lines:

class MicroBlogAdminIndexView(AdminIndexView):
    @expose('/')
    @basic_auth.required
    def index(self):
        return super().index()

class MicroBlogModelView(ModelView):
    def is_accessible(self):
        return basic_auth.authenticate()

    def inaccessible_callback(self, name, **kwargs):
        return basic_auth.challenge()

This example is very concise compared to the Flask-Login and Flask-Security examples.

As for the app, Post, db, etc. you mentioned, they have actually been mentioned in the context of this document. So, if the user reads this document completely, I don’t think there will be any gaps, what do you think?

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

Successfully merging this pull request may close these issues.

2 participants