6 Replies Latest reply on May 25, 2016 5:35 PM by paripirala RSS
    jrajesh Newbie

    Mashup session parameters in Java



    How can we set the session parameter value for a mashup before showing the mashup in a Custom Java Extension?


    Thanks and Regards,


      • Re: Mashup session parameters in Java
        paic Collaborator

        What is the use case for this?

        To be able to set the right session parameter, it has to be within the User Session Context, so if you are trying to set it server side, it still has to be invoked through that particular user's session.

        Earliest timing you can use would be the Mashup loaded event and you can use the services within the CurrentSessionInfo Resource to set the Session parameter.

          • Re: Mashup session parameters in Java
            jrajesh Newbie

            What I want to do is:

            1) Take the username and password from the user.

            2) Based on these, set a specific value somewhere

            3) Be able to access this value when I load the Mashup.

              • Re: Mashup session parameters in Java
                paic Collaborator

                You won't be able to retrieve the User's password.


                I think the easier way to go would be either using the User Extensions or Use Groups.

                User Extensions if they have to be unique values, and please note that Server side, using the CurrentSessionInfo Resource you can get the CurrentUser (user who is logged in)

                Groups if a set of Users all will receive the same value (then from CurrentUser, derive the group to derive the value)


                I believe the system provides what you need without the necessity of creating a custom extension.

                  • Re: Mashup session parameters in Java
                    jrajesh Newbie

                    Ok. Let me explain the complete use case.


                    There is another site which accepts the username/password, authenticates it and then gets the customer id/name.

                    Now there will be a link on that site which will point to a mashup on our site. I need to pass this customer id or name to this mashup.

                    I was thinking of using a Custom Authenticator for this purpose so that when the other site invokes our mashup, it may be able to pass the customer id/name in the url of the link which I can access as a request parameter in my Custom Authenticator and then set this value somewhere so that the Mashup can access it.

                      • Re: Mashup session parameters in Java
                        paic Collaborator

                        You could just pass on a user name and password from your other site, however if you are authenticating on the other site, that is an unsafe method and not recommended.


                        So indeed you should use a Custom Authenticator (you can get more information on this on the Support Portal)


                        I'm not sure if beyond that, you need to carry something over from that portal into Thingworx, if so, you can have the portal do a separate REST API call to Thingworx to set a User Extension value.

                • Re: Mashup session parameters in Java
                  paripirala Apprentice

                  @Rajesh by any chance did you resolve this issue? If so how?


                  We have similar use case. Appreciate your response.