[英]Can not secure AngularJS page using Spring Security
我正在使用Spring Security通過以下配置保護我的應用程序的安全,以嘗試顯示Spring默認登錄頁面:
彈簧security.xml文件
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
<http auto-config="true">
<intercept-url pattern="/**" access="ROLE_USER" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="test.account" password="123456" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
我的問題是所有資源都已成功通過身份驗證,而該文件始終對公眾開放,而該文件是Angular文件(localhost:8080 /#/ notification)。
編輯1 :
我試圖在Jetty服務器上運行上述spring安全配置,並且效果很好。 即使在將<sessions-enabled>true</sessions-enabled>
到appengine-web.xml中之后,該問題僅在使用Google AppEngine時出現。
先感謝您。
我已經能夠使用web.xml文件的<security-constraint>
屬性在Google AppEngine上使用Spring MVC保護靜態文件。
例:
<security-constraint>
<web-resource-collection>
<web-resource-name>Public Area</web-resource-name>
<url-pattern>/xyz</url-pattern>
<url-pattern>/images/*</url-pattern>
<url-pattern>/yyz/*</url-pattern>
<url-pattern>*.xml</url-pattern>
</web-resource-collection>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.