Change user in testing time - asp.net

I want to change or switch user in asp.net web application at time of automation testing. As there is no login page. The web application directly take user id from OS using (user.identification) and send to third party application and that send all the details of user like that user get login into web app.
Any one can tell me how change or switch user when do testing using protractor?

Related

How to notify an ASP.NET Core MVC web app about an event occurred in a third party app

I have a requirement wherein I need to perform certain action in my web application based on phone call receiving event that occurs in a third party application - Knowlarity SR calling app.
We are using Knowlarity Super Receptionist calling API to receive calls to a virtual number and then route those calls to call center Agents as per their availability. There is another web application we have built which call center agents uses to manage customers and orders. Agents login to this web application (web app in Azure) and places orders for customer who is calling over the phone from Knowlarity. Here the requirement is whenever Knowlarity routes the call to any agent and when the agent picks up the call, it should notify this action to web app (CRM) the web app should automatically redirect the same Agent to a specific page.
Please suggest a solution how I can listen to the call receiving event in Knowlarity and do some action(page redirection) on the web app side.
Thanks.
I tried writing an Api method in Web app which Konwlarity will call to send event notification with some information. Also tried implementing HttpHandler for this. Please suggest the correct approach for this. Remember that it is a Web app so multiple agents can login, they have their own session so how to handle this.

How to setup a login page in angular that allow to access asp.net web application

What i have already:
Two asp.net web applications with windows based authentication.
What i want now:
I want to create a login page in Angular 6 .
Consider the user click enters credentials and clicked signin on that page.
If the user is valid i should allow them to access asp.net web application which has got windows authentication enabled on it already.
So based on the inputs i should redirect user to the particualr asp.net web applications.
If the login fails i should show some error page.
Is that possible.IF yes how could we achieve it.
Is the ASP.Net website hosted in a different URL?
If so, once the Authentication API responds successfully, you can just bypass Angular's router and use window.location = "http://your.asp.net.website.com". If not, show the error message and prompt for the correct credentials.

Launching AngularJS (1.6) app from external application with User Authentication Token

I am looking forward for any help w.r.t launching my AngularJS (1.6) app from external application (A third party App, most probably will be .NET based) with User Authentication Token. This third party app will do authentication and load list table to Products, when they click details it should launch my app and load details of that Product, So I am looking forward to know how to pass ProductID, User Auth Token (or any other way maybe session cookies)

Single sign on implementation

We are trying to implement single sign on for two different web application located at different domain
WebApplication 1 (this will act as a front end where user log in)
WebApplication 2
the basic usage idea will be
User sign in trough a login screen in WebApplication 1
User click on a link in WebApplication 1 which will then open a popup screen to WebApplication 2 without signing in again
Now in order to achive this we created an ETL script which runs every 1 hour to synchronize the user and group accounts from web application 1 database to web application 2 database
Question
is there a better way to achieve single sign on rather then writing
a script that synchronize user account every 1 hour?
I have read new technology call WIF(Windows Identity Foundation) that is built in to .net framework 4.5 will this help to solve my issue above?
Running a script every hour is not a good idea as it be overhead on the server
To achieve single sign on for the different domain can be bit tough but not really impossible, It becomes difficult only because we cannot share the cookie across different domain. So we can have one different server for single sign on
When the user visit the web-application 1, redirect user to SSO server.
Once the user is redirected to the SSO server, check if the cookie exist, as its for the first time there will be no cookie so show the login page which is hosted on SSO server.
After getting the credential from the user validate the user
If the user is valid, generate a token now this token can be unique hexadecimal number or hash for the timestamps.
Set this token into the cookie on the SSO server and redirect the user back to the original site or success page
Now when user visit the web-application 2, redirect the user to the SSO server again
Once user comes to SSO, check for the cookie, if it exist and not expire then redirect user directly to the success page without asking for login credential again or show the login page and follow the drill again
As we are redirecting the user on the different server, we can set the cookie there with the common name as 'SSOcookie' and every time access the same when coming from different application. This will help you to achieve single sign on for different domain.

pass current web credentials from asp.net web application to a windows client application in vb.net

I'm developing a web application that requires the user to log in using forms authentication. inside the webpage you need to download a desktop application that requires to login to the same system too. Is there a way to transfer the current logged credentials from the web application to the windows desktop application without need to login again?. Both applications shares a Login object from an vb.net interface.
I tried to save the IP address in the Database but that don't work for me because the website needs to be accessed inside and/or outside of the company and the user cannot login twice in different machines.
I tried to google for solutions but without luck.
Do you have any suggestions regarding this?
This may not be exactly the scenario you're envisioning, but this article shows how to use Forms authentication from a Winforms client using WCF Authentication Services. This should get you going in the right direction. Per the article, you can use these services in any .NET application.
http://msdn.microsoft.com/en-us/library/bb386582.aspx
This article shows how to do it with a Silverlight app, just so you have another example. http://blogs.msdn.com/b/brada/archive/2008/05/03/accessing-the-asp-net-authentication-profile-and-role-service-in-silverlight.aspx
And just one more for fun. http://aspalliance.com/1595_Client_Application_Services__Part_1.all#Page1
There isn't really any way to share this without encrypting a file containing the user's credentials and storing it on the hard drive along with the file, but then you run the risk of someone decrypting the information and getting access to the user's password.
I think that an alternate approach that could work is to generate an authentication token (could be as simple as a GUID) and store it in your database along with the user's id when the user requests the download. You would want this token to expire after a reasonable time limit (5 minutes, for example).
You could then include a file that contains this authentication token with the download. When your apps starts, you could check for the existence of the file. If it's there, you extract the token, delete the file, send the token prior to presenting the user login.
If the token valid, your server would send back the user's login and your app would proceed as though the user were logged in, otherwise you would just display the login screen.

Resources