2 Replies Latest reply on Feb 7, 2011 5:48 AM by handat

    AMPostAuthProcessInterface redirect problem

      Hello friends

      I'm developing a custom login module inside a Sun Java System Access Manager 7.1 server. To do this I'm implementing AMPostAuthProcessInterface, in some cases I have to do a redirect, the code looks something like that

      try {
      if ((portalUser != null) && reorganize(AMService, portalUser)) {
      debug.message("Membresia reorganizada. Usuario: " + portalUser.getUsername());
      String redirectPath = config.getChangeMembershipPath();
      catch (Exception e)
      debug.message("Some error", e);

      If i run the example the server send me the next exception java.lang.IllegalStateException: Response has already been committed*... This same code works fine on the version 6.0 of the server, now I found some exaples that try to fix this problem, that is solved using costants that has been declared inside the interface (POST_PROCESS_LOGIN_SUCCESS_URL) by example:

      request.setAttribute( AMPostAuthProcessInterface.POST_PROCESS_LOGIN_SUCCESS_URL, "http://www.sun.com");

      The problem with this solution is that the servers api's don't give me that constats. Do you have some clues of how i can fix this problem?????. Any help will be appreciate

      Regards. Raul
        • 1. Re: AMPostAuthProcessInterface redirect problem
          Hello Everybody
          Do you have some response about the how to do the Redirect, my code looks something like that:

          public class ISAuthPostProcessTest implements AMPostAuthProcessInterface
          private static Debug debug = Debug.getInstance("amAuthPostProcessTest");

          public void onLoginSuccess(Map requestParamsMap,
          HttpServletRequest request,
          HttpServletResponse response,
          SSOToken ssoToken)
          throws AuthenticationException
          try {
               if (request != null)
                    request.setAttribute(AMPostAuthProcessInterface.POST_PROCESS_LOGIN_SUCCESS_URL, "http://mxcorpqa01.sun.com/amserver/UI/Login?goto=http://mxcorpqa01.sun.com/portal");

          } catch (Exception ex) {
          debug.message("onLoginSuccess exception while setting property :",ex);

          I put the follow CLASSPATH to compile
          /usr/jdk/entsys-j2se/bin/javac -classpath .:/opt/SUNWappserver/appserver/lib/j2ee.jar:/opt/SUNWam/lib/amserver.jar:/opt/SUNWam/lib/opensso-sharedlib.jar:/opt/SUNWam/lib/am_services.jar:/opt/SUNWam/lib/am_sdk.jar:/opt/SUNWam/lib/servlet.jar -d /var/opt/Utiles/postprocess_Costco ISAuthPostProcessTest.java

          And I can generate the jar, but the Access Manager 7 don´t take the new URL POST_PROCESS_LOGIN_SUCCESS_URL???? Any idea???


          Edited by: user9328974 on Jan 18, 2011 3:10 PM

          Edited by: user9328974 on Jan 19, 2011 10:47 AM
          • 2. Re: AMPostAuthProcessInterface redirect problem
            You need to use latest AM patch, ie AM 7.1 patch4+ in order for this to work. Earlier versions do not have this feature available.