Skip to Content

14 Comments

You must be Logged on to comment or reply to a post.

  1. Stefanus Z

    Hi there,

    I think this is a good first approach, I have copied it out and change the login form.

    However I have not found a way to redirect the user to my login page yet, since sap could just wipe sap package at any time to update their stuff, I don’t think this is a good idea?

    If anyone found a setting somewhere that I can set to point to another package for login that will be great!

    (0) 
    1. Pinaki Patra Post author

      Hi Stefanus,

      If you want to redirect the user to custom login page there is another way out.

      We can first look at how sap checks for the user login.

      1.Ajax call to chjeck if the user is already logged in (CRSF Token)

      2.If not redirect to the login page and create token

      (The code can be found at the ui/app.controller page)

      The same thing we can re-write on the on init event of our application controller . Then redirect the user for login to a custom .html login page with the target location as parameters.

      On successful login you can redirect back.

      Both the cases you have to set the authentation type to null in .xsaccess file as you will  be manually handling it.

      (0) 
      1. Stefanus Z

        Hi Pinaki Patra

        Thank you for the reply. Below is a piece of code for checking the session from app controller. 

        I change the else statement to a URLHelper redirect. However when going to the landing page, it seems it will load the original login form before redirecting it to mine. Is there a better way of doing this?

        Many thanks, I appreciate it!

          

        checkSession: function() {

                var view = this.getView();

                var origin = this.getParameterByName(“x-sap-origin-location”);

                $.ajax({

                    url: “/sap/hana/xs/formLogin/checkSession.xsjs”,

                    type: “GET”,

                    data: origin !== null ? {

                        “x-sap-origin-location”: decodeURIComponent(origin)

                    } : {},

                    success: function(resp) {

                        if (resp) {

                            if (resp[“x-sap-origin-location-ok”] === false) {

                                app.to(“ui.phishing.page”);

                                return;

                            }

                            if (resp.login === true) {

                                view.getController().handleSuccessfulLogin(resp);

                            } else {

         

                            sap.m.URLHelper.redirect(“MYLINK_HERE?x-sap-origin-location=”+origin, false);

                            }

                        }

                    }

                });

            }

        (0) 
        1. Pinaki Patra Post author

          Hi Stefanus,

          I think if you can write the same piece of code in your ui5 application controller :  function onInit Event and then redirect to your custom login page.

          You have to set the security type to null in the .xsapp of your ui5 appilcation.

          (0) 
          1. Stefanus Z

            hello Pinaki Patra,

            I tried that, its the same thing. I suppose it is because we are handling the login page from the front end. That is why, no matter what, it will load the original login page before redirecting it to my login page.

            I’m surprised that we can’t define this setting in xsengine.ini file or in some other file. So that the backend able to tell straight away which package to load.

            Yeah .xsaccess file is set to null since we want it to be accessible publicly. I have done that part.

            (0) 
  2. Prasad Kodati

    Hi Pinaki,

    We have followed the steps that are specified in the above document, but while changing any code in resource file to change the text on the Logon screen and running the application it is displaying logon page as a blank page.

    Kindly suggest how the application to be run once the changes are done in the standard HANA logon screen.

    As this is a priority for us, your prior response is appreciated. Thanks in advance.

    Thanks and Regards,

    Prasad.

    (0) 
  3. Srishti Gupta

    Hi Pinaki,

    I have followed the steps that are specified in the above document but the question arises for me is:

    How to use default logon with custom login table that consists of custom users and their password.

    As this is a required to me for my application, your prior response is appreciated. Thanks in advance.

    Thanks and Regards,

    Srishti

    (0) 
    1. Pinaki Patra Post author

      So what you are telling is that the users in your table are not database users.

      In that case I am not sure about the possibility.

      I am not sure but i think the alternate solution would be to create hana restricted users  and maintain a log of that in your table.

      Thay way you can make good use of the hana authentecation  layer without much effort

      (0) 
      1. Srishti Gupta

        Hi Pinaki


        I leverage the platform to get the user to login. Now, I’ve implemented the login in my app.

        But right now, I’m getting a little bit issue in implementing API for hotel on basis of location entered by user.


        Using Google API, I’m getting an error in the key generated i.e.


        <script   async defer src=”https://maps.googleapis.com/maps/api/jsv=3&key=AIzaSyCuiF_qkAS3B966HlA9yhf4vOQiKxBcE48” &libraries=places &callback=initMap>

        </script>

        Could you suggest which API I could use..Google API or Some other API of hotel which provides open access to its database of hotel ?


        Thanks for any help.

        (0) 
  4. Srishti Gupta

    But on Cleartrip there are no steps given to access API. I’m facing a little trouble in accessing and customizing the API.

    Could you provide me the link to access its API.

    (0) 
    1. Pinaki Patra Post author

      Hi , I would recommend you start a new discussion for he same.

      The clear-trip API is a public API and you can debug their website to view the api’s used.

      (0) 
  5. Robert James Camangon

    Hi,

    Currently, we use SAML SSO to our SAP HANA XS with our ADFS. Is it possible to redirect to a logon page if user has no access to ADFS but has access in SAP HANA? If it is possible, can you please help me on how to do it?

    Thanks a lot.

    Robert

    (0) 

Leave a Reply