spring - Question regarding value returned from WebAuthenticationDetails.getRemoteAddress() -


i writing custom accessdecisionvoter allow access resources if remote address of request found in list of allow ip addresses. however, value of remote address returned webauthenticationdetails.getremoteaddress() in format appears ipv6. when running app locally, returned above method:

0:0:0:0:0:0:0:1%0 

i'm storing allowed address in comma-delimited list in properties file. list parsed , each allowed address compared remote address, since have no idea how translate ipv4 address ipv6 address comparison fail.

so value returned webauthenticationdetails.getremoteaddress() or seeing because i'm running locally?

is there way convert string ipv4 string?

is there way have method in question return ipv4 string instead?

thanks!

you cannot convert ipv6 address ipv4 address. represent 2 different protocols. address of getremoteaddress() in format depending on protocol used create request webapp. guess see ipv6 address when using app locally. 0:0:0:0:0:0:0:1 address of localhost, same 127.0.0.1 in ipv4. think should add ipv6 address list of allowed ips.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -