关于Acegi 增加portmapping 的方法

关于Acegi 增加portmapping 的方法

Acegi缺省的port 映射是
80->443 443->80
8080->8443 8443->8080,
如果你的tomcat 用别的port 比如7070(http) 7443(https), 如果不自己加入这些mapping 当path 需要在
REQUIRES_SECURE_CHANNEL和REQUIRES_INSECURE_CHANNEL进行转换的时候, acegi 就无法工作.

解决问题是自己加入这些新的ports

   < bean  id ="secureChannelProcessor"
        class
="org.acegisecurity.securechannel.SecureChannelProcessor"   >
        
< property  name ="entryPoint" >
            
< ref  bean ="retryWithHttps" />
        
</ property >  
    
</ bean >
    
< bean  id ="insecureChannelProcessor"
        class
="org.acegisecurity.securechannel.InsecureChannelProcessor" >
        
< property  name ="entryPoint" >
            
< ref  bean ="retryWithHttp" />
        
</ property >          
    
</ bean >

    
< bean  id ="retryWithHttp"  class ="org.acegisecurity.securechannel.RetryWithHttpEntryPoint" >  
        
< property  name ="portMapper" >
            
< ref  bean ="portMapperImpl" />
        
</ property >
    
</ bean >
    
    
< bean  id ="retryWithHttps"  class ="org.acegisecurity.securechannel.RetryWithHttpsEntryPoint" >  
        
< property  name ="portMapper" >
            
< ref  bean ="portMapperImpl" />
        
</ property >
    
</ bean >
        
    
< bean  id ="portMapperImpl"  class ="org.acegisecurity.util.PortMapperImpl" >
        
< property  name ="portMappings" >     
             
< map >
                 
< entry  key ="80" >< value > 443 </ value ></ entry >
                 
< entry  key ="443" >< value > 80 </ value ></ entry >
                   
< entry  key ="8080" >< value > 8443 </ value ></ entry >     
                 
< entry  key ="8443" >< value > 8080 </ value ></ entry >     
                   
< entry  key ="7070" >< value > 7443 </ value ></ entry >     
                 
< entry  key ="7443" >< value > 7070 </ value ></ entry >                      
               
</ map >   
           
</ property >
    
</ bean >


  
这样一来acegi 就知道该怎么做了

你可能感兴趣的:(关于Acegi 增加portmapping 的方法)