Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the Subjects IP Address in JAAS

Tags:

java

jaas

I am a beginner and recently started understanding JAAS. Is there a way to get the Subjects IP Address in the login() method.

My objective is to perform IP Filtering for my server.

like image 223
Ajit Singh Avatar asked Oct 14 '25 04:10

Ajit Singh


2 Answers

JAAS is for Authentication and Authorization. IP Filtering is more fit to a firewall, most likely you don't want to handle it in your application. But to answer your question directly: you can't do this with JAAS.

like image 134
meskobalazs Avatar answered Oct 16 '25 18:10

meskobalazs


As the previous answer stated you can't do this with JAAS and should ideally do this in a firewall outside the application.

If you absolutely must do this in the application anyway then you can use JASPIC for this. It's the Java EE authentication mechanism and it allows full access to the http request and response.

like image 22
Mike Braun Avatar answered Oct 16 '25 18:10

Mike Braun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!