ここに問題の説明があります。私はGWTでWebアプリケーションを開発しています。私は、次のコードを使用して、認証機能のgwtにバネセキュリティを正常に統合しました。今私はWebアプリケーションで春の "メソッドセキュリティ"を使いたいと思っています。だから、僕は上記mentionnedアプリケーションコンテキストファイルに<global-method-security secured-annotations="enabled"/>
を追加Springセキュリティメソッドの承認が機能しない
、それはhttp://static.springsource.org/spring-security/site/docs/3.1.x/reference/ns-config.htmlに言ってやりました。
<http> <http-basic/> <intercept-url pattern="/**" access=""/> <form-login /> <logout /> </http> <authentication-manager> <authentication-provider> <user-service> <user name="jimis" password="jimispassword" authorities="ROLE_USER,ROLE_ADMIN" /> <user name="bob" password="bobspassword" authorities="ROLE_ADMIN" /> </user-service> </authentication-provider> </authentication-manager> **<global-method-security secured-annotations="enabled"/>**
、アクセス
をcontroleする私はその後、私はのようにweb.xmlのアプリケーション・コンテキストの宣言を追加する機能の上に注釈@Secured(「ROLE_ADMIN」)を追加すること次
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>App.html</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>10</session-timeout> <!-- in minutes -->
</session-config>
<context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext-security.xml </param-value> </context-param> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
<servlet>
<servlet-name>appService</servlet-name>
<servlet-class>com.google.gwt.app.example.server.AppServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>appService</servlet-name>
<url-pattern>/app/appService.rpc</url-pattern>
</servlet-mapping>
</web-app>
私はgwt-servletをSpringディスパッチャーサーブレットではなく宣言しました。
しかし、この設定は機能しないようです。実際、どのような役割であれ、機能にアクセスする権限を持つことができます。 非常に奇妙です。 あなたの答えを期待してください!
ありがとう、最初の解説のために、私は<! -
lhuang
をやったことがあります。 <! -
lhuang
申し訳ありませんが、あなたの答えを投票する権利はありませんでしたが、それは本当に役に立ちます – lhuang