为springside_miniweb提供一个flex登陆界面(第一部分)

为springside_miniweb提供一个flex登陆界面(第一部分)
miniweb采用的是spring security作为权限管理,我一直想搞一个flex界面。仿照igenko和puremvc的demo,搞了一个。
首先是修改一下服务端,主要是增加上对于graniteds的支持!
1.在pom.xml中加入依赖包
 
<!--  utils end  -->
        
<!-- 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 >
        
<!-- graniteds end  -->
        
<!--  testing begin  -->

2.在web.xml中声明一下
 
< 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而存在
  
package  org.springside.examples.miniweb.service;

import  javax.annotation.security.RolesAllowed;

import  org.springframework.stereotype.Repository;

@Repository(
" loginService " )
public   class  LoginServiceImpl {
    
/**
     * This method is used to check admin role with Acegi
     * 
     * 
@return  return always true because security check is done by Acegi
     
*/
    @RolesAllowed(
" ROLE_LOGIN_BACKOFFICE " )
    @SuppressWarnings(
" unchecked " )
    
public   boolean  checkLogin() {
        
return   true ;
    }

}

4.增加如下两个文件
 

关键部分的内容如下:
 
            < destination id = " login " >
                
< channels >
                    
< channel ref = " 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,这就是服务端的修改了。


客户端的代码思路我已经在http://www.blogjava.net/lanfanss/archive/2008/10/08/233071.html论述过了,提供代码:
http://www.blogjava.net/Files/lanfanss/springside_miniweb_flex.zip

下一篇说明怎么构建客户端代码

你可能感兴趣的:(为springside_miniweb提供一个flex登陆界面(第一部分))