Spring BlazeDS Integration简介与入门
2009-09-28 00:00:00 来源:WEB开发网为了定义安全处理器,首先需要向WEB-INF/flex/services-config.xml文件中添加两个额外的通道。
<channel-definition id="my-protected-amf"
class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/
gorilla/protected/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
<channel-definition id="my-protected-by-id-amf"
class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/
gorilla/protected2/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
接下来我们定义一个端点源(endpoint source),它配置了需要保护的端点或通道以及访问它们所需的角色。对于本示例来说,我们只定义一种用户角色,然后配置一个需要保护的URL及端点:
<bean id="configAttribute"
class="org.springframework.security.ConfigAttributeDefinition">
<constructor-arg type="java.lang.String" value="ROLE_USER"/>
</bean>
<bean id="endpointSource"
class="org.springframework.flex.messaging.security.EndpointDefinitionSource">
<constructor-arg>
<bean class="org.springframework.security.util.AntUrlPathMatcher"/>
</constructor-arg>
<constructor-arg>
<map>
<entry>
<key>
<bean class="org.springframework.security.intercept.web.RequestKey">
<constructor-arg value="**/protected/
messagebroker/**"/>
</bean>
</key>
<ref bean="configAttribute"/>
</entry>
</map>
</constructor-arg>
<constructor-arg>
<map>
<entry>
<key>
<value>my-protected-by-id-amf</value>
</key>
<ref bean="configAttribute"/>
</entry>
</map>
</constructor-arg>
</bean>
Tags:Spring BlazeDS Integration
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接