开发者

Flask authentication using LDAP

I've searched an answer for this but have found nothing - maybe because it's so obvious. But I want to make sure.

What is the correct way to authenticate users using an LDAP server in a Flask web app?

This link describes 4 authentication methods, so along the same lines, do I just need to write a开发者_JAVA百科n LDAP auth decorator?

(The reason I'm asking is to see whether I can make a Flask clone of my Django app)

Thanks for any help and suggestions.


Yes, you have to write your own decorator which checks the authentication.

In this decorator you should call the wrapped function if a user is authenticated. If not you should return a default page reminding the user to login.


I don't think you need a decorator, but it's a sensible thing to do, as it makes it easy to "tag" those routes that you want to require authentication.

Otherwise you'll be adding a lot more code whenever you want to implement some sort of authentication for a route.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜