<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><font face="Roboto">I found a solution myself:</font></p>
    <p><font face="Roboto"><br>
      </font></p>
    <p><font face="Roboto"><font face="Roboto">delta =
          ObjectDelta.summarize(modelContext.getPrimaryChanges());<br>
          <br>
        </font>String nsCommon =
        <a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>;<br>
        QName credentialQName = new QName(</font><font face="Roboto"><font
          face="Roboto">nsCommon</font>, "credentials");<br>
        ItemPath pwdValuePath = new ItemPath(</font><font face="Roboto"><font
          face="Roboto">credentialQName</font>,
        CredentialsType.F_PASSWORD, PasswordType.F_VALUE);</font><br>
      <font face="Roboto"><font face="Roboto">if(delta.hasItemDelta(</font></font><font
        face="Roboto"><font face="Roboto"><font face="Roboto">pwdValuePath</font>)){<br>
              println("user has changed the password");<br>
          }</font></font></p>
    <p><font face="Roboto"><font face="Roboto"><br>
        </font></font></p>
    <p><font face="Roboto"><font face="Roboto">now it works.<br>
        </font></font></p>
    <br>
    <div class="moz-cite-prefix">On 11/27/2017 05:18 PM, Marco Benucci
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9d7b2f59-67e0-606e-a684-b5c7844384a9@nsr.it">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <p><font face="Roboto">Hi,</font></p>
      <p><font face="Roboto">I'm running midPoint 3.6 and I'm playing
          with hooks.</font></p>
      <p><font face="Roboto">I'd like to detect when an user has changed
          his/her password using hooks and I have tried this without
          luck:<br>
        </font></p>
      <p><font face="Roboto">delta =
          ObjectDelta.summarize(modelContext.getPrimaryChanges());<br>
          QName pwdName = new QName(<a class="moz-txt-link-rfc2396E"
            href="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
            moz-do-not-send="true">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>,
          "credentials/password/value"); <br>
          ItemPath pwdPath = new ItemPath(pwdName);<br>
          if(delta.hasItemDelta(pwdPath)){<br>
              println("user has changed the password");<br>
          }<br>
        </font></p>
      <p><font face="Roboto"><br>
        </font></p>
      <p><font face="Roboto">Is there a better way to do this..?<br>
          <br>
          Thank you.</font></p>
      <p><font face="Roboto"><br>
        </font></p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>