このコンテンツは設定された言語で表示できません。

このコンテンツは表示可能な別の言語で表示されています。 お使いのブラウザに翻訳機能がある場合はご利用ください。

Configuring User Permissions in NI Auth for LabVIEW Web Services

Updated Aug 1, 2023

Environment

Software

  • LabVIEW

The following tutorial will walk you through setting up NI Auth for a Web Service. This ensures that only users with credentials are able to access the web service. 
Two processes are presented -- steps for LabVIEW 2011 and later, and steps for LabVIEW 2010 and earlier. 

For both examples, we'll be using testuser2 as the username, testpassword2 as the password, and testpermission2 as the permission.

LabVIEW 2011 or later

  1. Make sure LabVIEW (2011 or later) is installed.
  2. Open a web browser and navigate to http://localhost:3582. This will launch the NI Web Monitoring and Configuration utility.
  3. Click the Login button at the top right corner and enter in the appropriate user name and password. The default user name is admin and the default password is left blank. Click OK.
  1. Click the Security Configurations button on the left pane.
  1. Click the '+' button at the bottom of the window in the Users tab.
  1. Enter a username for the new user. In this example, the username will be testuser2.
  2. Enter a password for the new user by clicking on the Change Password button. The password will be testpassword2 for this example.
  3. Click the Save button at the bottom of the tab.
  4. Select the Permissions tab at the top of the window.
  1. Click the '+' button at the bottom of the window in the Permissions tab.
  2. Enter a name for this new permission and remove the group called everyone in the These groups have this permission section. In this example, the permission will be named testpermission2.
  3. Click the Save button at the bottom of the window to save the permission.
  4. Create or open an existing project with VIs that you wish to use as part of your web service. In this example, we'll be using a simple project with one VI that adds two numbers called add.vi.
  1. In the Project Explorer window, right-click My Computer and select New » Web Service. 
  2. Drag add.vi into the Web Resources folder in the Project Explorer. Configure your web service as desired (i.e. Service name, Source files, etc.).
  3. Select the HTTP Method VI Settings category from the left pane of the Web Service Properties window and highlight add.vi.
  4. At the bottom of the Web Service Properties window, select the Security tab listed under Web Service VI Properties.
  1. Click the blue '+' button to the right of the Required Permissions field underneath the Security tab.
  2. Type in the permission's name. 
  3. Finish configuring the properties of your web service as you desire and right-click the Web Service in the Project Explorer. From there, choose Application Web Server » Publish.
  4. To access this web service from a web browser, navigate to the appropriate URL mapping for the web service you configured. The URL can be found by right-clicking the add.vi in the Project Explorer and choosing  Show Method URL. For this example, the URL would be http://localhost:8080/testwebservice/add/<x>/<y> where <x> and <y> are the two numbers you wish to add.
    For example: http://localhost:8080/testwebservice/add/3/4
  5. This will take you to a login screen where you must enter in the username and password you created earlier.
  1. To access this web service from LabVIEW, you need to specify the username and password when you execute the Open Handle VI.

 

LabVIEW 2010 or earlier

  1. Make sur LabVIEW (2010 or earlier) is installed.
  2. Open a web browser and navigate to http://localhost:3582. This will launch the NI Web Monitoring and Configuration utility. 
  3. Click the Login button at the top right corner and enter in the appropriate username and password. The default username is admin and the default password is blank. Click OK. 
  1. Click on the Security Configurations button on the left pane.
  1. Click on the New User button at the top.
  1. Enter a username and password for this new user. 
  2. Click the Save button at the top of the tab.
  3. Click the New Permission button.
  1. Enter a name for this new permission. 
  2. Assign the permission to the user you created in steps 4-6.
  1. Click the Save button at the top of the window to save the permission.
  2. Click the Upload Changes button.
  1. Create or open an existing project with VIs that you wish to use as part of your web service. We'll be using the same simple project with add.vi for this example.
  1. In the Project Explorer window, right-click Build Specifications and select New » Web Service (RESTful). This will launch a properties dialog box to configure a web service. 
  2. Configure your web service as desired (i.e. Service name, Source files, etc.). In this example, we will name the web service testwebservice and use add.vi as our Service VI.


  1. Select the URL Mappings category from the left pane and select the URL mapping you wish to assign an NI Auth permission to. in this example, we will use the default URL mapping for the add.vi service VI.
  2. At the bottom right corner of the window, click the blue plus sign (+) and enter in the name of the permission you created earlier.
  1. Finish configuring the properties of your web service as you desire and click the Build button at the bottom of the window. Once the build is complete, click Done.
  2. Deploy the web service by right-clicking the web service name under Build Specifications and selecting Deploy.
  3. To access this web service from a web browser, navigate to the appropriate URL mapping for the web service you configured. For this example, the URL would be: http://localhost:8080/testwebservice/add/<y>/<x>, where <y> and <x> are the two numbers you wish to add.
    For example:  http://localhost:8080/testwebservice/add/3/4
  4. This will take you to a login screen where you must enter in the username and password you created earlier.
  1. To access this web service from LabVIEW, you need to specify the username and password when you execute the OpenHandle VI.