I have a feature in my upcoming web project where I will have to get the UserID/Email ID of the user currently logged in to the machine/PC. Target OS is Windows 10 and logins to the machines are done via Smart Card only. User Data is stored inside MS-AD.
This UserID will be used passed further for Authorization and load the app in browser. The target browser is IE and Chrome.
Is there a way i can fetch the EmailID/UserID of the User logged in via Smart Card to system in Javascript?
ADDITIONAL INFO: The website is setup in private environment. There is no public URL to access the webapp from outside Intranet. The client and backend code is hosted inside VM in Cloud. In nutshell, the is all sitting in private environment in Azure.
Thanks!
Not with JavaScript. JavaScript is run inside the browser container, and more specifically run inside your current webview. Letting JavaScript get access to settings and data on the local machine be a nightmare if phishing, malware and virus sites.
If you know which computers will run your website you could create an application with a server that's running idle on the machine, much like how Spotify's client is doing (the windows client can take commands from the webpage).
The application/server could then try to get the EmailID/UserID from the computer, and then having the server running on some specific port, your JavaScript could then use AJAX-requests to communicate with the local machine from the browser.
I could get the Windows Logged in user using the ActiveX script in IE.
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName)
Will this be a good approach to solve this issue?
Related
I have a webservice app, and this is connected to an android device to create "inspections". Once you have created it, there are options to "synchronize", which allows you to upload this inspections to the webservice through a REST service. The problem is that I have a different environment and I want the android device to work on my local environment (development) and not in previous environment as actually.
I have the device connected with localhost using "chrome://inspect/#devices" tool. Also, I have changed the "baseUrl" in app-config file. Now, the main problem is that I can't login on the device app, but the localhost on browser works.
Any suggestion? Thanks.
I have made a web page and i am running it on a local host using the xampp server. In this web page I have a canvas that draws a line between two point. I read these points from a locally available csv file that I have generated. I would like to make an android application, where there is a provision to enter two numbers. I want this android application to make a csv file and save it on my computer so that I can access this file using my javascript.
Note: can I pass these values via an usb connected between the mobile and computer so that I can make a csv file locally in my computer? I want all of this to happen without the requirement of internet connection.
PS: I am newbie to android. If the above is possible, then please brief on how to approach this problem.
If you have a XAMP server all you need to do is connect the android device to the same network/router. There you can talk via HTTP methods to the apache server. You will just need to provide the ip address to the android app.
In the router you can set a static ip address for the mac address of your computer, so every time it connects to the router it always get the same IP and you dont need to input it again on the android app.
We have a fully functional website. Now we want to develop a windows 10 app and since hosted web apps seem the quickest way we want to explore that option. I have created hosted web app for our site but can I embed any local code in the app that can communicate with code website. Like can I change the user agent string to recognize request is from hosted web app? Can I access camera from local code? I was unable to find any resources on these. Or do I have to use a webview in UWP app and load website in it? Any suggestions?
Check this page first. If your url is defined within the app’s bounds(ACURs), then you can call windows runtime api which can help you acess to camera. But I didn't find any windows runtime API which can help you change your user agent.
I am working on a very old web application(only for intranet usage). In the code, the developer is obtaining the logged in account via this
var wshNetwork = new ActiveXObject("WScript.Network");
document.getElementById('userId').value = wshNetwork.UserName;
This works only in IE. How can I get the logged in account in Firefox/chrome?
I have looked in to other thread (ex: Finding the currently logged in user from a Firefox extension) but that's only for extension.
Are there any other ways to get the domain logged in username in Firefox/Chrome?
No, this is severely security-sensitive information - the main attack vector for compromising your computer. In IE it also only works for trusted websites such as localhost, or with special configuration for the local network - never on internet without additional configuration. Sandboxed JS will never be able to access this information - extensions are considered elevated.
This is something that I would do on server side. Providing you're using IIS, I would set the page to be using only Windows Authentication, read the current user on server side, and send it back to client via hidden field or javascript variable.
My organization already developed iOS and Android apps, and is starting to develop an app for Windows 8. In case it matters, the app is using Phonegap a.k.a. Cordova.
On the existing apps, the user downloads a very "slim" app from the store, containing a minimal HTML page. The user logs into a server, and then script tags are dynamically added pointing to locations on that server. Similar to web apps, scripts are downloaded to the client and then executed.
Windows 8's new security model blocks this behavior. Since the app runs in the local context and the script is on the web, I get the error "An app can’t load remote web content in the local context."
Is there a way to get around this restriction?
I'm open to "creative" suggestions and hacks, up to a point. I've already tried a few things, such as fetching a script with plain XHR calls and then injecting the response to a pre-defined script tag. Windows blocked this and all other attempts.
I also considered rendering everything in an iframe with a "ms-appx-web:" scheme (learned about this scheme here, "Schemas and contexts" section). This might allow me to load remote scripts, but would prevent code from accessing APIs of the locally-running JavaScript code -- Cordova and Windows Runtime. This access is necessary for my app. If there's a way to access Cordova and Windows Runtime from the web context, that might be useful too.
I very much doubt it.
The whole point of the MS Windows Store certification model is that they can test your code for malware/ crashes. If you can change the code on the fly, you could ship a perfectly harmless app, have it certified by MS, and then change it to something dreadful after the user installs it.