2015-02-03 2 views
6

ho la primavera successiva configurazione di sicurezza frammento:sicurezza Primavera hasIPAddress multipla antMatchers

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

Questo funziona, ma mi piacerebbe anche concedere l'accesso a "/ gettoni" da 127.0.0.1. Speravo qualcosa sulla falsariga di quanto segue avrebbe funzionato, ma doesnt:

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

risposta

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

tenta di impostare questa configurazione nel file di configurazione di sicurezza primavera come questa risposta

<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

destro grazie ma Non sto usando un file di configurazione. – MarcF