How to achieve "Remember Me" functionality for both local and remote login pages? - authentication

I have a requirement in my application for iOS and Android, developed using IBM Worklight, to remember the user ID if the user selected this option.
I can achieve this by using localStorage, but the issue is that I have two login pages:
One is placed within the application, and the
Second is hosted on a remote server
Depending on the conditions the application will meet, either the remote login page will be displayed or the local login page will be displayed.
If I use localStorage on local page it is not accessible for server side login page. So I want to use some storage/file on the mobile to store my user id which is accessible for both local and server login page. Is this is possible using worklight/phonegap storage?
More explanation:
Remote login page is hosted on some www.xxx.com domain. My requirement is on launch of application the local login page is shown to the user, there user can enter user id and password and selects remember me option and submits form. Then user logs in and navigated to some xxx.com/yyy server page. From there when user clicks on log out it navigates to remote login page which is hosted on www.xxx.com server. As user already checked remember me option in local page the remote login page has to pre populate the user id text box. And same scenario should happen when user enters credentials in remote login page and selects remember me check box. So when user kills the application from background and relaunches the application user will get local login page where I need to pre populate the user id last time he entered.

Short answer: in my opinion, no.
Longer answer: I will explain what I think using your scenario:
Remote login page is hosted on some www.xxx.com domain. My requirement
is on launch of application the local login page is shown to the user,
there user can enter user id and password and selects remember me
option and submits form.
So far so good. You can store it in either Web Storage or JSONStore or use Cordova File API. Catch: all of these are available ONLY for the specific application.
Then user logs in and navigated to some xxx.com/yyy server page. From
there when user clicks on log out it navigates to remote login page
which is hosted on www.xxx.com server. As user already checked
remember me option in local page the remote login page has to pre
populate the user id text box.
Still plausible. Lets say the user selected 'Remember Me', so you can adjust the URL pointing to the remote login page and send with it as parameters the username and password. Assuming that there will a mechanism to handle those on the remote page.
This does not come for free, though.
This is not meant to work out-of-the-box. It's worth noting that whether Web Storage (localStorage...) is used or any other type of storage- the application and the Cordova InAppBrowser do not share the same localStorage, and the same is true if you open a new WebView.
And same scenario should happen when user enters credentials in remote
login page and selects remember me check box. So when user kills the
application from background and relaunches the application user will
get local login page where I need to pre populate the user id last
time he entered.
This is also a problem IMO, because any application is sandboxed - be it the browser app or the Worklight app, each of them is sandboxed. so you can't just go to website X, and create some localStorage for it and expect that data to be available for another WebView belonging to another app. That's the whole point of sandboxing, in order to protect the app.
And in this case, where the remote "page" will save the data, only Web Storage is available anyway, as JSONStore requires the Worklight API, which is not available when you load external websites.
Notes:
Since you want to save both username and password, you'd probably want to encrypt them in some way, so JSONStore and WL.EncryptedCache are your options, rather than plain Web Storage.

Related

Why is Salesforce redirecting all my community users to the same user while using an external Identity identity provider?

There is a Salesforce application with community users who have a landing page URL for which access needs to be provided to endusers through email which cannot be done. The requirement is for the enduser to make use of their phone number or employee id as they cannot have fresh email addresses.
When i try to connect the SFDC to my external IDP, it is able to go with the IDP for authentication and finally login to the application. However the user that is logged in always reverts back to a single user in the application though i make use of seperate logins for each time.
Ex: User login is alex12 and i login, it will take me through to the landing page in the community page.
user login is mike23 and when i login, it will pass through fine but the landing page in the community page will still show alex12 instead of mike23.
What should i do to get all the users in community user to login and land on the community page successfully for each user?
Any help is appreciated as i need to deploy for a client and this on the escalation track.

Simulating web site with remembered user in selenium

I'm collecting user actions from a web page. For example; www.test.com/home. After that I'm simulating user's actions in same page with selenium. But user logged in test.com and browser remember this(with cookie, storage, firebase, google account etc. Doesn't matter).
When I open www.test.com/home with selenium in another server, of course browser doesn't remember user's login credentials and opening login page.
Is there any way simulating a page in another server with remembered user.

How to make windows authentication to authenticate based on the user instead of the machine?

I'm trying to make my web application to authenticate using windows authentication, but when i add Integrated Security = True in my connection string instead of authenticating using the user name it instead uses the machine name.
I dont know if i making myself clear but here are some images of the actual problem.
So here is the image of my connection string code on webconfig
but using this the aplication tries to authenticate using my machine name as shown here: (CEBI\INFODSKT003$)is my machine name , but i wanted it to use the name of the user logged. can someone help me here? thanks,
If you want to use the same network user for your site, regardless of the user using your website, you need to set your website's application pool to run as a network user.
You can do this by opening the IIS manager, selecting the app pool and clicking Advance Settings... under the Actions pane menu. Select Identity and then click the button beside the current user listed. Select Custom account and click Set. Use the format domain\username for the username and enter the password for the user.
If you want each of your websites user to access the database, each with its own network user name, then take a look at ASP.NET Impersonation.

Session between different browser

I am Working in ASP.NET MVC4 web application using Forms Authentication.
I have an application where user logs in to enter the application, if a user opens the application in a browser and logs in,and if user opens the application in some other browser in the same system they should not allow to logged in and give alert message as "User is already logged in a different browser". The same should happen within the same browser in different tabs and also in the different instance of same browser in which user was Previously logged in.
Please give me Your suggestions.....

How does Google Glass authentication work?

I am trying to create a sample test application that authenticates a user wearing Google Glass.
I have read the following page
https://developers.google.com/glass/develop/gdk/authentication
I need to know how will the authentication actually work. Now lets say I have an app "XYZ" uploaded onto MyGlass. User turns on the app via MyGlass and then automatically gets redirected to a web page say, for example,
http://www.example.com/glass/authenticate.html
In this web page, he has to sign in using a username and password. Once he clicks submit will he be redirected to another webpage on the browser or will the Glass application get activated. Where will the userToken be obtained. Will it be on Glass?
I am really confused. Please can someone help me out.
What exactly is the flow for authentication on Glass?
Assuming you're doing 3rd part authentication (i.e. your own users, not google accounts).
Once you click Submit on your login page:
Server-side: If the user is valid, call the Mirror API to insert the account, including your authToken and the userToken. The userToken will be a query parameter added to your login url by the glassware store.
Close the page using window.close(). The Glassware will then be installed on the user's device.
When the user launches your glassware, retrieve the account from the Mirror API, and then retrieve the authToken that you inserted in step 1. for that particular account.