Is there an ArcGIS Runtime API for getting server info?
For instance populating Esri.ArcGISRuntime.Security.ServerInfo given the server Uri?
Using ArcGIS Runtime 100.15 for .NET
Generally the runtime will auto-discover these for you. The exception is OAuth where you need to provide some of that info up front (like client id etc), but again most of it is loaded for you once you hit that server.
What is the reason you're needing the server info?
Actually I was thinking of a workaround for AuthenticationManager not providing the correct OAuth authorization URLs.
We have a portal with Azure AD authentication and a federated server.
ArcGIS Server service:
Federated to portal with AAD auth set up:
IOAuthAuthorizeHandler.AuthorizeAsync gets called with with:
serviceUri = https://myserver.company.com/servermm/rest/services/MyService
authorizeUri = https://myserver.company.com/servermm/rest/sharing/oauth2/authorize
callbackUri = https://myserver.company.com/servermm/rest/sharing/oauth2/approval
But that doesn't work - since it needs to go via the portal, so it ought to be:
authorizeUri = https://myserver.company.com/portal/sharing/oauth2/authorize
callbackUri = https://myserver.company.com/portal/sharing/oauth2/approval
As far as I could see (using ILSpy), AuthenticationManager tries to guess the authorization url, rather than using server info (owning system).
I've tried calling AuthenticationManager.Current.RegisterServer(serverInfo) with manually supplied ServerInfo.OwningSystemUri. But I still can't get it working.
So for now I've resorted to patching the authorizeUri and callbackUri so they hit the portal instead, and then it works.
The server info endpoint: https://myserver.company.com/servermm/rest/info
seems to provide the correct/expected owningSystemUrl and tokenServicesUrl values.
I've based the OAuth handler code on an Esri sample: