浏览 3265 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2011-03-23
最后修改:2011-03-23
service-config.xml
<security> <security-constraint id="basic-read-access" > <auth-method>Custom</auth-method> <roles> <role>ROLE_USER</role> <role>ROLE_ADMIN</role> </roles> </security-constraint> <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/> </security> flex-servlet.xml
<flex:message-broker > <flex:remoting-service default-channels="my-amf" /> <flex:secured per-client-authentication="true" > <flex:secured-channel access="ROLE_USER" channel="my-amf"/> </flex:secured> </flex:message-broker> srping-security.xml
<?xml version="1.0" encoding="UTF-8"?> <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.0.xsd"> <http entry-point-ref="entryPoint"> <anonymous enabled="false"/> </http> <beans:bean id="entryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/> <authentication-manager alias="authenticationManager"> <authentication-provider> <user-service> <user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" /> <user name="user" password="user" authorities="ROLE_USER" /> </user-service> </authentication-provider> </authentication-manager> </beans:beans> flex登录
var myChannelSet:ChannelSet = ServerConfig.getChannelSet(messageServiceRO.destination); var token:AsyncToken = myChannelSet.login(userName,password); token.addResponder( new AsyncResponder( function(event:ResultEvent, token:Object = null):void { if (event.result.authorities.indexOf("ROLE_ADMIN") >= 0) { Alert.show("Admin登录成功!"); } else { Alert.show("User登录成功!"); } PopUpManager.removePopUp(_this); }, function(event:FaultEvent, token:Object = null):void { Alert.show("Login Failed: "+event.fault.faultString); } ) ); 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2011-04-02
你对了吗,我怎么试着不对啊
报这个错误 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is java.lang.NullPointerException |
|
返回顶楼 | |