2015-02-03 23 views
6

aşağıdaki bahar güvenlik yapılandırma pasajı vardır:Bahar güvenlik birden hasIPAddress antMatchers

http 
    .authorizeRequests() 
    .antMatchers("/tokens").hasIpAddress("10.0.0.0/16") 
    .... 

Bu ben de 127.0.0.1 dan "/ jeton" erişim vermek istiyorum ama çalışır. Ben işe yarayacağını aşağıdakilerden çizgisinde bir şey umuyordum ama o doesnt:

http 
    .authorizeRequests() 
    .antMatchers("/tokens").hasIpAddress("10.0.0.0/16").hasIpAddress("127.0.0.1/32") 
    .... 

cevap

15
http 
    .authorizeRequests() 
    .antMatchers("/tokens").access(
      "hasIpAddress('10.0.0.0/16') or hasIpAddress('127.0.0.1/32')") 
.... 
2

deneyin bu

<http auto-config="true" use-expressions="true"> 
<intercept-url pattern="/tokens**" access="hasIpAddress('10.0.0.0/16') or hasIpAddress('127.0.0.1/32')" /> 
</http> 
+0

Doğru cevap teşekkür gibi bahar güvenlik yapılandırma dosyasında bu yapılandırmayı ayarlamak için ancak Bir yapılandırma dosyası kullanmıyorum. – MarcF

İlgili konular