So I have looked everywhere for this but I couldn't find an answer.
I have recently integrated flask-admin to my flask application, which is already, partly secured using flask-httpauth's basic authentication. I am using the @auth.verify_password decorator to verify the credentials using httpauth.
I tried following the examples about how to integrate flask-basicauth with flask-admin using custom Views but I couldn't find a method that asks for the user login as the basic_auth.challenge()
.
So here's the question, how could I fill this custom admin view to integrate httpauth?
class MyAdminIndexView(AdminIndexView):
def is_accessible(self):
if not auth.current_user():
raise AuthException('Not authenticated.')
else:
return True
def inaccessible_callback(self, name, **kwargs):
# What can I put in place of this:
return redirect(auth.challenge())
Or else, what's the alternative?
from Securing Flask-Admin with Flask-HTTPAUTH
No comments:
Post a Comment