G Web Development Software

cancel
Showing results for 
Search instead for 
Did you mean: 

Username/password for a web application

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?

Brian Powell
Stravaro, LLC


Learn more about the DSH Pragmatic Software Development Workshops.
Message 1 of 9
(16,929 Views)

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.

Sujay Narayana
Principal Software Engineer
0 Kudos
Message 2 of 9
(16,900 Views)

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.

 

0 Kudos
Message 3 of 9
(16,896 Views)

@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 

0 Kudos
Message 4 of 9
(16,880 Views)

@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 

Message 5 of 9
(16,868 Views)

Awesome tutorial. Finally got me get started with some working code

0 Kudos
Message 6 of 9
(16,761 Views)

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).

0 Kudos
Message 7 of 9
(16,731 Views)

Can anyone share the example source code? I cannot get the download link from studiobods link provided.

Thanks & Regards,
Irfan
(CLD)
https://haliatech.com/
0 Kudos
Message 8 of 9
(15,027 Views)

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. 

0 Kudos
Message 9 of 9
(12,657 Views)