Spring security whiltelist incoming service call

2/24/2021

In Spring security you can whitelist the incoming IP using hasIpAddress. Is it possible to have a whitelist for the incoming domain/url/servicename?

I have two services in a kubernates cluster, most of their endpoints can only be accessed with the accessed token (legacy filter can't be removed). However, I would like one service to call the other without a token for a particular endpoint (let's say service A call service B). Is it possible to specify the service name rather than the ip to be whitelisted in service B? I don't want to make the endpoint to be publicly accessible. Do I have to convert to IP like this

InetAddress ipaddress = InetAddress.getByName(service);

Is there something smart for Kubernetes services?

-- user1619397
kubernetes
spring-boot
spring-security

1 Answer

3/27/2021

Maybe you can try to use the internal kubernetes dns link so you don't have to specify the ip address.

-- Hendrik Kremer
Source: StackOverflow