cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable login on local web application?

Former Member
0 Kudos

Hi experts!

  I'm desperate in need of help. I have a web application that I'm running locally in a Tomcat 7 server that calls services in other application via URL calls. Example: I have a TestView.view.js that has a button, and that button has a press event handled in the controller, TestViewController.js like this:

onRefresh: function() {

  var context = this.getView().getBindingContext()

  var url = Config.getUrlFor("hana:test.status", this.getParams())

  var m = new sap.ui.model.json.JSONModel(url);

...

}

and the Config file is mapped like

hana: {

  host: "sap-hana-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

  protocol: "http",

  port: "8000",

  contextPath: "",

  basePath: "xxxxxxxxxxxxxxxxxxxxxxx/WebContent",

  path: {

  test: {

  status: '../../../xxxxxxxx/service/services.xsjs',

...

}

Well, on my service I have to check the authenticated user to do some validations, like this:

var user = $.session.getUsername()

The problem is, when I log into the admin console and call '../../../xxxxxxxx/service/services.xsjs' via browser I have the right user, for example "RODRIGO" (myself); but when I call '../../../xxxxxxxx/service/services.xsjs' from my web application, there's no user loged, so I can't do anything else.

I need a way to set a login form of some kind into my web application so the user can log in and I can use that session to get the user logged into my application. Something I can run locally and use, like running my Tomcat, access http://localhost:8080/login, enter my user and password, go to TestView  and press the button and my service knows that "RODRIGO" is logged.

Please I need help! Sorry if I'm confused, been working for this for some time now. Thanks in advance!!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please check this link to create a login page:

http://scn.sap.com/community/developer-center/front-end/blog/2014/06/19/login-page-for-custom-sapui5...

I know this is for UI5 application but i think it can be used as long as you have an SICF service for your application to work on.

Let me know.