This discussion is archived
1 Reply Latest reply: Jul 13, 2012 8:13 AM by 949347 RSS

How can we retrieve LDAP error code from a form based authentication ?

925694 Newbie
Currently Being Moderated
Hi,
I would to display a well formatted message error when the login failed. It would be based on the LDAP code error returned by Active Directory.
So far oracle oc4j return either error or success. I dont know what kind of errors we have.

I have created a login page such as :

<form method="POST" action='<%= response.encodeURL("j_security_check") %>'>
<TABLE class="libParam">
     <TR>
          <TD>Utilisateur <strong class="libelleRouge"> <strong></TD>
          <TD><input type="text" name="j_username" size="32" /></TD>
     </TR>
     <TR>
          <TD>Mot de passe :<strong class="libelleRouge"> <strong></TD>
          <TD><input type="password" name="j_password" size="32" /></TD>
     </TR>
<TR>
<TD class="libelleChampsObligatoires"><%=util.IDefine.LIBELLE_TOUS_CHAMPS_OBLIGATOIRES%></TD>
</TR>
<TR>
<TD colspan="2" align="right">
     <input type="submit" value="Valider" onclick="this.disabled=true;this.value='Patientez...';this.form.submit()">
</TD>
</TR>
</TABLE>
</form>

When there is an authentication error the class ErrorLoginAction is thrown.
But I dont know how to get the type of errors from this class ?

public ActionForward doExecute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
          return retourneAvecErreur("", "erreur.login.password", request, mapping, "erreurLogin");
     }

In the OC4J log i got details of the type of LDAP error but i cannot display it in my login page of course.
How can I process the LDAP error from a struts class or the login.jsp page ?

Thanks

Edited by: 922691 on 11 juil. 2012 23:30

Edited by: 922691 on 11 juil. 2012 23:30

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points