<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-text-flowed" style="font-family: -moz-fixed;
      font-size: 14px;" lang="x-western">Hello all,
      <br>
      <br>
      I sent this out a couple of weeks ago but didn't get any responses
      so I figured I'd send it again in case it was missed. Any
      suggestions or assistance would be greatly appreciated.<br>
      <br>
      We are using LDAP user/pass authentication with Shibboleth IdP
      2.3.5. We currently extract the password as an attribute for one
      specific internal SP using this code:
      <br>
      <br>
      &lt;!-- Add password as attribute--&gt;
      <br>
      &lt;resolver:AttributeDefinition id="password" xsi:type="Script"
      xmlns="urn:mace:shibboleth:2.0:resolver:ad"&gt;
      <br>
      &lt;resolver:AttributeEncoder xsi:type="SAML1String"
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="urn:mace:dir:attribute-def:password" /&gt;
      <br>
      <br>
      &lt;resolver:AttributeEncoder xsi:type="SAML2String"
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="urn:oid:2.5.4.35"
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friendlyName="password" /&gt;
      <br>
      &lt;Script&gt;
      <br>
      &lt;![CDATA[
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
importPackage(Packages.edu.internet2.middleware.shibboleth.common.attribute.provider);<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
importPackage(Packages.edu.internet2.middleware.shibboleth.idp.authn.provider);<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; importPackage(Packages.java.io.*);
      <br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create new password attribute
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password = new BasicAttribute("password");
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get subject only if the session exists (to avoid smal1)
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( requestContext.getUserSession() )
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get Subject
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; userSubject =
      requestContext.getUserSession().getSubject();
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // There are two PrivateSessions existed, only get class
      UsernamePasswordCredential
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i =
userSubject.getPrivateCredentials(edu.internet2.middleware.shibboleth.idp.authn.provider.UsernamePasswordCredential).iterator();<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while(i.hasNext()) {
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; credential = i.next();
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      password.getValues().add(credential.getPassword());
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]]&gt;
      <br>
      &lt;/Script&gt;
      <br>
      &lt;/resolver:AttributeDefinition&gt;
      <br>
      <br>
      This has worked fine for us over the past few years. Lately,
      however, whenever we restart the IdP we sometimes get the
      following error in idp-process.log:
      <br>
      <br>
      WARN
      [edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition.ScriptedAttributeDefinition:153]
      - password unable to compile even though the scripting engine
      supports this functionality.
      <br>
      <br>
      This error happened in our old 2.1.5 IdP as well as the new 2.3.5
      instance. It seems that the error shows up completely at random.
      Sometimes after a restart we don't get it at all, other times it
      will appear once and then not come back after another reboot, and
      other times we will have to keep restarting the IdP several times
      for it to not appear. When it does appear, though, SPs will be
      able to create valid sessions with the IdP, but no attributes will
      be released to any SP.
      <br>
      <br>
      Does anyone have an explanation as to why this error shows up at
      random or what is causing it?
      <br>
      <br>
      Thanks,
      <br>
      Mike
      <br>
      Stevens Institute of Technology<br>
    </div>
  </body>
</html>