Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Submit form the classical way for (semi) 'Single-Sign on'

    Hello,

    Using:
    SmartClient Version: SC_SNAPSHOT-2011-11-10/PowerEdition Deployment (built 2011-11-10)


    I have some sort of Single-Sign on requirement that I want to implement as follows (and yes it is a bit of a hack).

    A users logs in in my app, and then his entered credentials are immediately added to a DynamicForm which (classically) submits to an external domain (with synced user accounts obviously).

    This way, from the other system's point of view, it looks like a login event.

    So all I want is this to work:
    Code:
    DynamicForm moodleLogin = new DynamicForm();
    moodleLogin.setCanSubmit(true);
    moodleLogin.setMethod(FormMethod.POST);
    moodleLogin.setAction(event.getMoodleUrl()+"/login/index.php");
    
    HiddenItem usr = new HiddenItem("j_username");
    usr.setDefaultValue(username);						
    
    HiddenItem pw = new HiddenItem("j_password");
    pw.setDefaultValue(pass);
    
    moodleLogin.setFields(usr,pw);
    moodleLogin.submitForm();// this ought to work, an offline test with a form injected by plain javascript into the dom and submitted via javascript, worked.
    My goal is that this redirects out of my system, and into 'Moodle', and opensource e-learning app. If this works, I am happy, but the form is not submitted.

    That is, no POST is done according to Firebug's NET panel.

    Is this a bug or a feature (ie. security feature).

    Could you shed some light on this?

    #2
    If you can, use a plain HTML login screen instead, for the reasons given in the QuickStart Guide. See also wiki.SmartClient.com for an example of a plain HTML login screens, and how it can be used with various authentication systems.

    Comment


      #3
      Alright, but is my code supposed to submit (and thus redirect to the external domain)?

      I will look into that other option, but still would like to know if that code i posted is supposed to submit to the external domain.

      Could you give me that information?

      Comment


        #4
        Your code just leads to a warning in the log because it's usually an accident that anyone tries to do what you're doing. You can then setDirectSubmit(true) to actually force the form to submit, which will cause the whole page to be wiped out as data is posted to the remote site (like a plain HTML form).

        Comment


          #5
          Thanks alot!

          Comment


            #6
            Where is this method located, in DynamicForm?

            It seems that the method 'setDirectSubmit' does not exist.

            (Now using SmartGWT Power 3.0, nightly of 2012-02-27)

            Anyway, I would still very much like to force the submission, including page wipe out.

            (PS: You guys are doing an awesome job in general!)

            Comment


              #7
              Hello, could some1 enlighten me on my previous question?

              Comment

              Working...
              X