Auto login only for white list IP

Hello,

I’m trying to set up auto-login for the Vision client on specific computers based on their IP address, while using the standard login with ID/password for other computers.

I created an “AutoLogin” user with the “AutoLogin” role in the Gateway configuration under Security > Users, Roles.

In the Designer, I enabled auto-login with the username “AutoLogin”.

Finally, I added a startup client event script:

pcName = system.tag.readBlocking(["[System]Client/Network/Hostname"])[0].value



#------------------------ PC --------------------------------------------------------------
if pcName == "M1-5VPVJ34--":
    system.nav.openWindow("Main Window")

#-------------------------- ROLE ---------------------------------------------------------------------
else:
    roleToCheck = system.tag.readBlocking(["[System]Client/User/RolesString"])[0].value
    if roleToCheck == "AutoLogin":
        system.security.logout()
    elif roleToCheck == "Administrator" :
        system.nav.openWindow("windows2"
)

It work well when I am on an authorized IP but otherwise I have this message:

Unexpected exception retrieving UDT definitions during component startup

details:

IllegalStateException

Ignition v8.1.45 (b2025010709)
Java: Azul Systems, Inc. 17.0.13

I am not sure this is the proper way to do it…

Has anyone successfully did auto loging but just for authorized IP?

This is probably not related to what you're doing in the script.

Can you copy and past the full details of that error message here?
Use preformatted text; see Wiki - how to post code on this forum.

Thanks for your quick replly.

If I comment system.security.logout() I do not have error message.

Here is the full error message:

java.lang.IllegalStateException
at com.inductiveautomation.factorypmi.application.runtime.ClientContextImpl.getTagManager(ClientContextImpl.java:542)
at com.inductiveautomation.factorypmi.application.VisionClientContextDelegateAdapter.getTagManager(VisionClientContextDelegateAdapter.java:175)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor$UDTInitVisitor.initialize(ComponentVisitor.java:138)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor$UDTInitVisitor.visit(ComponentVisitor.java:116)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:82)
at com.inductiveautomation.factorypmi.application.components.util.ComponentVisitor.walk(ComponentVisitor.java:73)
at com.inductiveautomation.factorypmi.application.FPMIWindow.initializeUIRoot(FPMIWindow.java:336)
at com.inductiveautomation.factorypmi.application.FPMIWindow.initialize(FPMIWindow.java:284)
at com.inductiveautomation.factorypmi.application.VisionDesktop$RuntimeWindowOpener.openWindow(VisionDesktop.java:540)
at com.inductiveautomation.factorypmi.application.VisionDesktop.openWindow(VisionDesktop.java:192)
at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.lambda$openWindowImpl$5(NavUtilities.java:393)
at com.inductiveautomation.factorypmi.application.script.builtin.WindowUtilities.doGUIAction(WindowUtilities.java:851)
at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.openWindowImpl(NavUtilities.java:336)
at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.openWindow(NavUtilities.java:326)
at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilitiesDispatcher.openWindow(NavUtilitiesDispatcher.java:143)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:190)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.call(ScriptManager.java:553)
at org.python.core.PyObject.call(PyObject.java:461)
at org.python.core.PyObject.call(PyObject.java:465)
at org.python.pycode._pyx0.f$0(:14)
at org.python.pycode._pyx0.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1703)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:804)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:773)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:740)
at com.inductiveautomation.factorypmi.application.FPMIApp.startup(FPMIApp.java:498)
at com.inductiveautomation.factorypmi.application.runtime.ClientPanel.lambda$startupApp$8(ClientPanel.java:911)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Ignition v8.1.45 (b2025010709)
Java: Azul Systems, Inc. 17.0.13


You were right if I remove “open on start up” option on the Main Window in the disigner do do not have the error. Thanks

2 Likes