Skip to Content
0
Former Member
Aug 12, 2015 at 10:53 PM

How to enable login on local web application?

27 Views

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!!