For Programmers: Free Programming Magazines  


Home > Archive > Java Security > April 2006 > Restricting socket connections to a particular host









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Restricting socket connections to a particular host
Cameron McCormack

2006-04-17, 4:07 am

Hi everyone.

I'm not very familiar with the security classes in Java, so hopefully
someone can help me. I want to restrict the current thread from making
any connections to a host other than one that I specify (ideally I'd
like to enforce this restriction just in a block of code), in much the
same way that same-host origin security is enforced in applets. It also
should be possible to connect to this host through the proxy that is set.

I will be making connections using a HttpURLConnection object. Since
this object will hide redirects from me, I can't just compare the host
of the URL I will be fetching initially. I can create a
SocketPermission that represents the connection I wish to allow, but I
don't know what to do with this object, or to make sure that all other
connections fail.

Can someone point me in the right direction?

Thanks,

Cameron

--
Cameron McCormack ICQ: 26955922
cam (at) mcc.id.au MSN: cam (at) mcc.id.au
http://mcc.id.au/ JBR: heycam (at) jabber.org
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com