Getting Hostname IDP is running on

Ramon Pfeiffer ramon.pfeiffer at uni-tuebingen.de
Mon Aug 12 03:53:00 EDT 2019


Hi Chris,

I faced the same problem, I resolved it using java.net.InetAddress as
you already suggested, by injecting it as a custom object into the views:

global.xml:
    <util:map id="shibboleth.CustomViewContext">
        <entry key="inetAddress">
            <bean class="java.net.InetAddress" />
        </entry>
    </util:map>

You can then access the inetAddress in your views via the $custom object:

footer.vm:
	$custom.get('inetAddress').getLocalHost().getHostAddress()

I don't know if injecting it as a custom object is necessary, but it
worked for me.

HTH,
Ramon


On 09.08.2019 19:41, Christopher Bland wrote:
> Hi All,
> 
>  
> 
> I have setup a cluster of v3.4.4 IDP servers sitting behind a load
> balancer. I am looking to tag my login pages so I know which server a
> user hit if there’s a problem.  I have looked at Request.getServerName()
> and Request.getIPAddress() which are both part of HttpServletResponse. 
> Unfortunately because my serves are behind a load balancer when I call
> either method I can only see the IP address and DNS name on the load
> balancer and. not the actual server name.  While I am not a Java
> programmer,  I have been digging into possible solutions and I think I
> need to access the java.net.InetAddress class so I can call
> getLocalHost() and/or getHostName(). 
> 
>  
> 
> I am assuming that java.net.* is part of the default context.  If not is
> it recommended to add it?  I think I can  context.put("InetAddress",
>  InetAddress.class); to add InetAddress to the context.  Additionally,
> if java.net.* is part of the default context do I access it via
> context.getLocalHost()?
> 
>  
> 
> I welcome all suggestion and thoughts,
> 
>  
> 
> -Chris
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5437 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://shibboleth.net/pipermail/users/attachments/20190812/cb9891e6/attachment.p7s>


More information about the users mailing list