IP Camera Viewer Authentication

I am having an issue with the IP Camera viewer logging in to cameras. I have an existing installation, and we are replacing the cameras in the faciility. I have assigned each camera a url with user:pass@IP . This format pulls up a jpg in a web browser with no issues.

The client finds the camera fine, but pops up the Java login screen asking for the credentials to the camera. If I enter them in the popup the camera comes up. If I check save password it saves the password until the client restarts. I need to either get the URL user/pass to work, or get the saved password to survive a restart, I can’t have the facility entering passwords for every camera every time the computer restarts. I have also tried tying the username and password properties for our camera template to a sql database with the correct user/pass info.

Any suggestions would be greatly appreciated. We are using Avigilon IP cameras if anyone has experience with them specifically. I have used other camera brands with this system without any problem

I have a similar problem with Ignition 7.9.3. Did you find a solution?

The component has username, password, and useAuthentication properties. When set these allow the component to authenticate using HTTP Basic authentication. Have you tried this yet?

The short answer is no, I didn’t. Fortunately restarts are very rare here and there are only 50 or so cameras on the HMI so I can reenter them occasionally. FWIW, I did come across a couple of potential “solutions” but I have not yet implemented either one.

The better solution, but which is going to be seriously time intensive is to use VLCJ. I know it is possible to create an out of process popup with VLC for each camera you want to call up, and I came across at least one implementation that looked like it would work while searching the Ignition forums, but it was definitely not going to be plug and play with Ignition and I haven’t had time to play with it.

Another solution depending on your VMS is to use a Java-.NET bridge and use the VMS SDK to implement video.

Finally, I talked to Ignition support at length about this, and their suggestion was to use the browser plugin to call up the still jpeg, since the authentication worked there. The browser can then be set to refresh every 100ms or so, giving you the same effect as jpeg callup in the camera viewer. I played around with this, and it will work but I was updating an existing site with new cameras and because of the way I implemented the IP cam viewer (calling properties from a sql db) this was going to require a major rewrite beyond just the Ignition part and I havent had time. I will probably do this next time I create a new application, because it works well enough.

I am using D-Link DSC-3410 IP camera’s and the solution I have found for this issue was simple. I deleted the admin password for the camera. The feed now starts up in the client without needing authentication. And yes I know this is a security hole but for my application no one will die or go to jail. Hope this helps

I was having the same issue with the Java authentication popup on the IP Camera Viewer for certain cameras.
The way I got around it was by overriding the Java authenticator.
I called the following custom method before setting the url property in scripting.
Note, I am not sure how this will affect other network requests from the client.

def setAuthenticator(username, password):

	from java.net import Authenticator
	from java.net import PasswordAuthentication
	from java.lang import String
	
	class DefaultAuthenticator(Authenticator):
		usr = ""
		pwd = ""
		def setCredentials(s, u, p):
			s.usr = u
			s.pwd = p
	
		def getPasswordAuthentication(s):
			return PasswordAuthentication(String(s.usr), String(s.pwd).toCharArray())
	
	auth = DefaultAuthenticator()
	auth.setCredentials(username, password)
	Authenticator.setDefault(auth)

To remove the set authenticator, you can call:

Authenticator.setDefault(None)

For more details, see the Java docs.

4 Likes

canmatt3,
Will you take a look at my attempt to use your fix and see if you can tell me what I’m doing wrong.
I put your script in a custom method on the iPcamera Viewing object. (see attached pic)

It could be a couple of things.
First, your last 3 lines are indented too much. They should only be indented one level, the same as the class declaration.
Second, the usr/pwd default values are overwritten with the values of the username/password parameters, which should be passed in to the script when it is called.
If this doesn’t fix it, we could look at how you are calling the script.

1 Like

I think I have it like you suggested. No luck the Java authentication popup is still popping up when the client is first opened.

See if you can see any other mistakes. Also How should I call this Custom Method’s script?

The custom method needs to be called before the IP Camera Viewer tries to connect.
You could try this in the propertyChange event on the IP Camera Viewer component:

if event.propertyName == "componentRunning" and event.newValue:
    event.source.CameraLogin(event.source.username, event.source.password)
1 Like

Camatt3, Thank you for your help.
I would have never solved this on my own.
For anyone else that might have this same problem, I have inserted pics of all the properties and scripting. (The URL is for a Axis M3066-V camera) Thanks again to camatt3.

1 Like