为springside_miniweb提供一个flex登陆界面

miniweb采用的是spring security作为权限管理,我一直想搞一个flex界面。仿照igenko和puremvc的demo,搞了一个。
首先是修改一下服务端,主要是增加上对于graniteds的支持!
1.在pom.xml中加入依赖包

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> <!-- utilsend -->
<!-- graniteds -->
< dependency >
< groupId > org.graniteds </ groupId >
< artifactId > graniteds-core </ artifactId >
< version > 1.1.0-RC2 </ version >
</ dependency >
< dependency >
< groupId > org.graniteds </ groupId >
< artifactId > graniteds-spring </ artifactId >
< version > 1.1.0-RC2 </ version >
</ dependency >
<!-- granitedsend -->
<!-- testingbegin -->

2.在web.xml中声明一下

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> < filter >
< filter-name > AMFMessageFilter </ filter-name >
< filter-class > org.granite.messaging.webapp.AMFMessageFilter
</ filter-class >
</ filter >
< filter-mapping >
< filter-name > AMFMessageFilter </ filter-name >
< url-pattern > /graniteamf/* </ url-pattern >
</ filter-mapping >

< servlet >
< servlet-name > AMFMessageServlet </ servlet-name >
< servlet-class > org.granite.messaging.webapp.AMFMessageServlet
</ servlet-class >
< load-on-startup > 1 </ load-on-startup >
</ servlet >
< servlet-mapping >
< servlet-name > AMFMessageServlet </ servlet-name >
< url-pattern > /graniteamf/* </ url-pattern >
</ servlet-mapping >

3.写一个鸡肋一般的登陆类,作为service而存在

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --> package org.springside.examples.miniweb.service;

import javax.annotation.security.RolesAllowed;

import org.springframework.stereotype.Repository;

@Repository(
" loginService " )
public class LoginServiceImpl{
/**
*ThismethodisusedtocheckadminrolewithAcegi
*
*
@return returnalwaystruebecausesecuritycheckisdonebyAcegi
*/
@RolesAllowed(
" ROLE_LOGIN_BACKOFFICE " )
@SuppressWarnings(
" unchecked " )
public boolean checkLogin(){
return true ;
}

}


4.增加如下两个文件


关键部分的内容如下:

< destinationid = " login " >
< channels >
< channelref = " my-graniteamf " />
</ channels >
< properties >
< factory > springFactory </ factory >
< source > loginService </ source >
</ properties >
< security >
< security - constraint >
< auth - method > Custom </ auth - method >
< roles >
< role > ROLE_LOGIN_BACKOFFICE </ role >
</ roles >
</ security - constraint >
</ security >
</ destination >

ok,这就是服务端的修改了。

提供代码:
源码下载

你可能感兴趣的:(spring,xml,servlet,Flex,Security)