[Building Sakai] EntityBroker IP Filtering

Holladay, Bryan Andrew bahollad at indiana.edu
Tue Aug 4 11:15:47 PDT 2009


Sorry, I didn't notice the bottom half of that message... So the best way would to save the IP's in a property and check the request IP against that?

Bryan


On 8/4/09 2:13 PM, "Bryan Holladay" <bahollad at indiana.edu> wrote:

I'm interested in the IP of the server that is making the request.

Background:

I wrote some entityproviders to get some information for a Mobile portal (not sakai, but some other server) and I only want that known server to call these entity classes to make this even more secure.

Thanks,
Bryan


On 8/4/09 2:07 PM, "Aaron Zeckoski" <aaronz at vt.edu> wrote:

If you are trying to get the IP address of the server you are
currently on you can do this:
            try {
                InetAddress i4 = Inet4Address.getLocalHost();
                serverName = i4.getHostAddress();
            } catch (UnknownHostException e) {
                // could not get address, do something else
            }

If you want to get the IP address of the request:
String ipAddress = (HttpServletRequest) request.getRemoteAddr();

You can get the request in your entityprovider using this capability:
http://qa1-nl.sakaiproject.org/codereview/trunk/api/org/sakaiproject/entitybroker/entityprovider/capabilities/RequestAware.java.html

Hope that helps
-AZ


On Tue, Aug 4, 2009 at 7:01 PM, Holladay, Bryan
Andrew<bahollad at indiana.edu> wrote:
> All,
>
> I am trying to do some IP filtering in an EntityProvider that is not inside
> the tool layer.  I was looking at the RemoteHostFilter.java class but that
> looks like it depends on the web.xml settings in the tool layer.  Is there a
> good way to do IP filtering in the impl layer?
>
> Thanks,
> Bryan
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
> with a subject of "unsubscribe"
>
>



--
Aaron Zeckoski (azeckoski (at) vt.edu)
Senior Research Engineer - CARET - University of Cambridge
https://twitter.com/azeckoski - http://www.linkedin.com/in/azeckoski
http://aaronz-sakai.blogspot.com/ - http://tinyurl.com/azprofile


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090804/2e3fce05/attachment.html 


More information about the sakai-dev mailing list