<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>We are trying to add a check on the user’s IP address to determine whether or not the user is coming from on or off campus.</div>
<div><br>
</div>
<div>IdP version: 2.4.4</div>
<div>Tomcat: 6.0.24</div>
<div>Java: OpenJDK 1.7.0.75</div>
<div>OS: RHEL 6.6</div>
<div><br>
</div>
<div>In a scripted attribute, I’ve tried to use the following calls to get the user’s IP address. Every call results in the getInboundMessageTransport() returning a null value, which obviously causes the getPeerAddress() call to fail. Other calls to methods
contained within the requestContext succeed (example, the getEntityId() call works fine).</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px;">
<div>
<div>try {</div>
<div> var ipAddress = requestContext.getInboundMessageTransport().getPeerAddress();</div>
<div>} catch (err) {</div>
<div> var ipAddress = 'unavailable'</div>
<div> logger.warn(pre + err);</div>
<div>}</div>
<div>logger.debug(pre + "ipAddress = " + ipAddress);</div>
</div>
</blockquote>
<div>
<div id="">
<div><br>
</div>
<div>The idp-process.log entries look like this:</div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px;">
<div>
<div>
<div>2015-05-26 10:34:48.817 - WARN [edu.internet2.middleware.shibboleth.resolver.Script.validAuthContexts:-2] - TypeError: Cannot call method "getPeerAddress" of null</div>
<div>2015-05-26 10:34:48.817 - DEBUG [edu.internet2.middleware.shibboleth.resolver.Script.validAuthContexts:-1] - ipAddress = unavailable</div>
</div>
</div>
<div><br>
</div>
</blockquote>
<div>Any suggestions?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Mark</div>
<div><br>
</div>
<div>---</div>
<div>Mark McCoy</div>
<div>Identity Management</div>
<div>The University of Texas at San Antonio</div>
<div>210-458-5871</div>
<br>
</div>
</div>
</body>
</html>