Commit bbae6101 authored by Ivan Tyagov's avatar Ivan Tyagov

Init first x.509 encryption and only after

that username / password authentication.
parent aee64ab6
......@@ -138,17 +138,6 @@ int main(int argc, char **argv)
addVariable(server);
addValueCallbackToCurrentTimeVariable(server);
/* Disable anonymous logins, enable two user/password logins */
if (ENABLE_USERNAME_PASSWORD_AUTHENTICATION){
UA_UsernamePasswordLogin logins[1] = {
{UA_STRING(USERNAME), UA_STRING(PASSWORD)},
};
config->accessControl.clear(&config->accessControl);
UA_StatusCode retval1 = UA_AccessControl_default(config, false, NULL,
&config->securityPolicies[config->securityPoliciesSize-1].policyUri, 1, logins);
}
/* Enable x509 */
#ifdef UA_ENABLE_ENCRYPTION
if (ENABLE_X509){
......@@ -178,6 +167,17 @@ int main(int argc, char **argv)
}
#endif
/* Disable anonymous logins, enable user/password logins */
if (ENABLE_USERNAME_PASSWORD_AUTHENTICATION){
UA_UsernamePasswordLogin logins[1] = {
{UA_STRING(USERNAME), UA_STRING(PASSWORD)},
};
config->accessControl.clear(&config->accessControl);
UA_StatusCode retval1 = UA_AccessControl_default(config, false, NULL,
&config->securityPolicies[config->securityPoliciesSize-1].policyUri, 1, logins);
}
// enable protocol for Pub/Sub
UA_ServerConfig_addPubSubTransportLayer(config, UA_PubSubTransportLayerUDPMP());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment