本文介绍了在Java EE中使用过滤器授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用户进入安全网页。 过滤器拦截用户的请求。 过滤检索用户对象从会话。 如果用户对象存在,允许用户在安全的页面。 如果用户对象不存在,重定向用户到登录页面。
User enters a secured page.
Filter intercepts user request.
Filter retrieves User object from session.
If User object exists, allow user to the secured page.
If User object doesn't exist, redirect user to the login page.
系统使用所提供的凭据对数据库进行身份验证的用户。 如果认证成功,在会议系统存储用户对象,并显示欢迎页面。 如果身份验证不成功,系统将用户返回到登录页面。
System authenticates user using the provided credential against the database.
If authentication is successful, system stores User object in the session and displays welcome page.
If authentication is not successful, system brings user back to the login page.
我有一个用户和密码MongoDB的基础。我有授权形式的JSP文件。过滤器应检查 - 授权用户或没有。 Servlet的应授权用户,如果他没有被授权。
I have mongodb base with users and passwords. I have a jsp file with a form for authorization. filter should be check - authorized user or not. Servlet should authorize user if he not authorized.
请给出如何做到这一点简单的例子。
Please give simple examples of how to do it.
- 如何验证授权用户或不?
- 的用户没有登录。假设一个用户是在数据库中。它是如何结果授权?
抱歉不好英语。
推荐答案下面是一个情景: -
Here's a scenario:-
当用户从登录页面提交证件: -
When the user submits the credential from the login page:-
更多推荐
在Java EE中使用过滤器授权
发布评论