10-07-2021 11:59 AM
If I build a web application, is it possible to have the web server require a username/password to access it? I don't need anything fancy; just something like htpasswd on Apache.
I see user/role options in the NI Web Server Configuration program, but it seems that those are for web server configuration, not for web apps. (Am I wrong?) Also, there doesn't seem to be a way to add users unless I want to tie them to Windows accounts or LDAP servers. (In case it matters, I do not have a license for SystemLink. Maybe it provides something more powerful.)
If the web server can't support usernames/passwords, then I guess I will have to implement my own login screen and a simple token mechanism to get to the main app. It doesn't need to be super-secure, just keep casual interlopers away. Is there a better approach?
10-08-2021 04:25 AM
I'm not an expert with the authentication aspects of using webVI-based applications. I found this page which might be of some help (there's an NXG Web Module based example attached, you can open it in GWeb to convert it): Hosting a WebVI Securely on Your Own Network Using NI Web Server - NI Community
Just for reference, this page talks about securing webVI-based applications with SystemLink Cloud.
10-08-2021 07:36 AM - edited 10-08-2021 07:40 AM
We have an example online at https://github.com/ni/systemlink-web-interface-template that shows how to add permissions to the NI Web Server, which you can use to gate who has access to your web application.
Unfortunately, the NI Web Server and SystemLink don't allow adding custom users or managing their passwords since we don't ship an identity provider with it. You can use Windows accounts, LDAP, Active Directory, or OpenID Connect (https://operations.systemlink.io/openid-connect/openid-connect/). With OpenID connect you can enable logging in using other identity providers including ones like Google.
10-08-2021 10:49 PM - edited 10-08-2021 11:07 PM
@bhpowell wrote:
I guess I will have to implement my own login screen and a simple token mechanism to get to the main app. It doesn't need to be super-secure, just keep casual interlopers away.
Ah, sounds good. if have made such implementation, please your kind favor to share as example for us. it would be helpful.
I'm also looking how to implement cookies in webvi especially to create and maintain user credential log-in while browsing in. any example 🤔
like the one in NI Week 2019 below: (unfortunately can't find the example source code) ☹️
Learn how to create powerful web apps with LabVIEW NXG Web Module
10-09-2021 06:17 AM
@ThamS wrote:like the one in NI Week 2019 below: (unfortunately can't find the example source code) ☹️
Found the link 😀
Learn how to create powerful web apps with LabVIEW NXG Web Module - NI WEEK 2019
11-07-2021 02:21 PM
Awesome tutorial. Finally got me get started with some working code
11-09-2021 03:27 PM
The tutorial above has very nice example code on how to implement user authentication from within a web application. It uses the session VIs that are part of the webservices tools. These session VI's allow you to set cookies and set parameters. The http client adds these parameters to each http request, making it easy to see which authenticated user issued the request. But here's is where I got stuck. The session VIs are supported by the application web server only and thus not by the NI web server.
I am now attempting to manually implement a session cookie, but I do not have this functional yet (cookie gets overwritten).
03-08-2023 03:25 AM
Can anyone share the example source code? I cannot get the download link from studiobods link provided.
04-08-2024 12:40 PM
Hey, thank you for sharing how the code worked. Can you please share that working code? I can't download it from the link above provided.