Spring保安的新手。我已经通过了一些教程并实现了Spring Security。我有几个页面,我通过登录保护。
这是我的spring-security.xml档案
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/person*/*"
access="hasRole('ROLE_ADMIN')" />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<security:user name="admin" password="password"
authorities="ROLE_ADMIN" />
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>
</beans>
从我的index.jsp,当我试图访问人
URL时,它要求身份验证。我有注销网址。在JSP页面内。
<a href="<c:url value="logout" />" > Logout</a>
控制器
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public ModelAndView logoutPage(HttpServletRequest request, HttpServletResponse response) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null) {
new SecurityContextLogoutHandler().logout(request, response, auth);
}
return new ModelAndView("redirect:/");
}
很好用。除了几件事当我尝试转到/person/add
时,它直接转到页面,而不是询问身份验证。为什么?如何解决?我是否需要在截取URL中提及所有URL(如果我有许多URL怎么办?)
最主要的是,我正在尝试为我的应用程序配置SSL。
我安装了这个教程。
>
现在,我有以下的Spring安全。xml
<代码>
SSL正在工作。但登录不起作用。当我转到persons
URL时,它显示页面而不要求验证。为什么?
我尝试添加access=hasRole('ROLE\u USER')
,然后当我提供正确的凭据时,tomcat显示访问被拒绝。
如何解决?我想为所有URL启用SSL。
我正在使用Spring4.2。2.释放和Spring安全4.0。2.释放
首先,尝试重写您的安全性:拦截url
,如下所示:
<security:intercept-url pattern="/person*" access="hasRole('ROLE_ADMIN')" />
<security:intercept-url pattern="/person/**" access="hasRole('ROLE_ADMIN')"
关于SSL,本教程非常好,应该是开箱即用的,也许问题再次在于拦截url,试试我的建议。
我正在尝试使用解析SDK进行Facebook的单点登录,但是当我按下登录按钮时,我收到此错误: 哦哦。出现错误:错误域=com.facebook。sdk Code=2“操作无法完成。(com.facebook.sdk error 2.)”UserInfo=0x1d5bac20{com.facebook.sdk:ErrorLoginFailedReason=com.facebok.sdk:Syste
问题内容: 这里的另一个新手..我正在尝试修复以下代码,以防止sql注入,并学习编写php和sql的新方法。 您的建议将不胜感激。 我修改了这个 为此,我没有得到相同的结果。 问题答案: 您不能将mysql与mysqli或PDO混合使用。您需要查看错误日志,因为这不可能实现-您应该看到大量致命错误。
我在通过网络浏览器(IE或Chrome)使用ADFS登录应用程序时遇到问题。我希望使用ADFS SAML自动、透明地登录用户(当前用户已登录),而无需输入这些标识符。 所以我有2台运行Windows 2016 Server的服务器:-第一个Serv1:带有Active Directory目录的域控制器-第二个Serv2:ADFS服务器(4.0),它连接到控制器Serv1 当我试图访问我的应用程序时
我已经在我的xamarin Android应用程序中实现了脸书认证,一切都很好。我从facebook获得令牌,并使用firebase rest Api的sigin方法,我能够sigin到firebase,并从firebase Api收到一个访问令牌,作为JWT。但是,当我想在我的Web Api核心上使用这个访问令牌时,它总是返回not authenticated。我的Web Api核心使用下面基于
我使用的是在带有弹性负载均衡器的 AWS 实例中运行的Spring启动。我正在使用带有登录安全性的Spring MVC,服务器端口设置为8080。我在 ELB 中安装了一个 AWS 生成的证书,该证书具有正确的 Web 名称 test.mydomain.com。弹性负载均衡侦听器针对端口 80 HTTP 进行了设置 当我访问主页时,https://test.mydomian.com/home,一切
拉威尔6。PHP7.4。 我正在建立一个网站。因为Laravel提供了默认的身份验证登录和注册表单。我将登录表单放入导航中,而注册页面上的注册表单。现在我想让用户在注册页面上提供另一个登录表单。 我设计了另一个登录表单,在提交时,我将其引用到相同的登录路径,但它不起作用。错误是419页已过期。 我也读过关于MutiAuth的文章,但这是我将在我的管理面板上使用的东西。有什么解决办法吗? Regis