mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-20 16:52:07 +08:00
f6549e2612
Backport of OPCFoundation/UA-.NETStandard@8f4087605a from `master` to `master378`. ### Summary Makes `Session.ValidateServerEndpoints()` compare `ServerEndpoints` and `UserIdentityTokens` as unordered sets and adds regression tests verifying `OpenAsync()` no longer rejects legal servers that return the same endpoint data in a different order. ### Problem Per OPC UA Part 4, the client validates the endpoint set returned by `CreateSessionResponse.ServerEndpoints` against the set observed during discovery. The spec describes these as a *set* of endpoint descriptions filtered by transport profile, not an ordered array. Previously the validation compared `m_discoveryServerEndpoints[ii]` against `serverEndpoints[ii]` by index, and `UserIdentityTokens[jj]` by index. A server returning the same legal endpoints/token policies in a different order could be wrongly rejected with `BadSecurityChecksFailed`. ### Changes - Replace index-based `ServerEndpoints` validation with unordered matching on the same endpoint fields already validated by the client. - Compare `UserIdentityTokens` as an unordered multiset. - Extend the client session test scaffolding so discovery endpoints can be supplied explicitly. - Add regression tests for reordered `ServerEndpoints` and reordered `UserIdentityTokens`. ### Notes Adapted to the `master378` API surface (`EndpointDescriptionCollection` / `UserTokenPolicyCollection` / `StringCollection` / `byte[]` server nonce) and the `Libraries/`/`Tests/` layout. Client tests build and the new tests pass. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>