Spring Security hasIpAddress issue -


i have method in controller using below configuration:

@requestmapping(value = "/encore/{username}/{token}", method = requestmethod.get) @responsebody @preauthorize("hasipaddress('192.168.1.2/24')") public encoreaccount validateuserrequest(httpservletrequest request,     @pathvariable(value = "username") string username,     @pathvariable(value = "token") string token) { } 

and have 1 in webmvc-config.xml

<security:global-method-security pre-post-annotations="enabled" /> 

but when run it, below exception:

caused by: org.springframework.expression.spel.spelevaluationexception: el1004e:(pos 0): method call: method hasipaddress(java.lang.string) cannot found on org.springframework.security.access.expression.method.methodsecurityexpressionroot type 

i know hasipaddress() in org.springframework.security.web.access.expression.websecurityexpressionroot.

do know why doesn't method in websecurityexpressionroot?

many thanks,

the hasipaddress() expression available web security.

org.springframework.security.web.access.expression.websecurityexpressionroot

@preauth uses

org.springframework.security.access.expression.method.methodsecurityexpressionroot

you can secure url (intercept) hasipaddress() not method.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -