UA Ansi C Server Professional
1.3.0.225
|
This lesson will show how to add user authentication to the server using the SDK's Internal authentication module. Alternatively one could use one of the other authentication modules or write and use a custom one.
Content:
For telling the server to use Username/Password authentication, we need to change the endpoint configuration. We use the endpoint configuration of the previous lesson and simply set another TokenType. As this is the only UserTokenPolicy, clients are forced to use this authentication type, otherwise they are not able to connect.
Also we need to tell the SDK which authentication module to use. This is done by calling the UaServer_SetUserAuthenticationTypeEx function, passing UserAuthType_Internal as authentication type.
The next step is to setup the user database to be used for verifying logons. The SDK's internal authentication module uses a users file for this, one example file is provided with the lesson. As authorization is also enabled by default, we will need the group file provided with the example, too. There are some predefined users in the files, the passwords are listed in Internal authentication module. Simply copy the files next to the generated server application and start up the server.
To test our configuration, we connect to the server using UaExpert.
Discover the server like in the last lesson. You will notice the difference in the available authentication settings. Now, the Anonymous option is greyed out and only the Username/Password option is available. Select it and enter
as the credentials.
You might get the same certificate warning messages as in the last lesson, if so follow the same steps. After the certificates have been accepted on both sides, you will be connected to the server, authenticated by username and password.