|
@@ -455,20 +455,25 @@ static UA_StatusCode EndpointsHandshake(UA_Client *client) {
|
|
|
|
|
|
if(!UA_String_equal(&endpoint->securityPolicyUri, &securityNone))
|
|
|
continue;
|
|
|
- endpointFound = true;
|
|
|
+
|
|
|
|
|
|
+ endpointFound = true;
|
|
|
+
|
|
|
|
|
|
for(size_t j = 0; j < endpoint->userIdentityTokensSize; ++j) {
|
|
|
UA_UserTokenPolicy* userToken = &endpoint->userIdentityTokens[j];
|
|
|
-
|
|
|
- if(client->authenticationMethod == UA_CLIENTAUTHENTICATION_NONE){
|
|
|
- if(userToken->tokenType != UA_USERTOKENTYPE_ANONYMOUS)
|
|
|
- continue;
|
|
|
- }else{
|
|
|
-
|
|
|
- if(userToken->tokenType != UA_USERTOKENTYPE_USERNAME)
|
|
|
- continue;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ if(userToken->securityPolicyUri.length > 0 &&
|
|
|
+ !UA_String_equal(&userToken->securityPolicyUri, &securityNone))
|
|
|
+ continue;
|
|
|
+
|
|
|
+
|
|
|
+ * UA_CLIENTAUTHENTICATION_USERNAME == UA_USERTOKENTYPE_USERNAME */
|
|
|
+ if(client->authenticationMethod != userToken->tokenType)
|
|
|
+ continue;
|
|
|
+
|
|
|
+
|
|
|
tokenFound = true;
|
|
|
UA_UserTokenPolicy_copy(userToken, &client->token);
|
|
|
break;
|