I've created separate methods for authentication (one for on-line and one for on-premise). Right now, I'm letting the user select which method to use (and then provide the URL of organization service and the credentials).

I'd like to automatize the process and it hit me that the information about the type of authentication should be in the discovery service. It so, too. I can get it using the following code.

DiscoveryServiceProxy discovery = new DiscoveryServiceProxy(
  logOnInformation.Organization,
  logOnInformation.HomeRealm,
  logOnInformation.ClientCredentials,
  logOnInformation.DeviceCredentials);

Console.Write(discovery.ServiceManagement.AuthenticationType`);

My problem here is that in order to create a discovery service proxy, I need to specify the device credentials, which is obtain using the authentication procedure the type of which I'm trying to determine. It's catch 22...

How can I determine the authentication type solely based on the URL of the discovery or organization service?

有帮助吗?

解决方案

I just put a small sample here. Tested for LiveID and ActiveDirectory.

IServiceManagement<IOrganizationService> organizationServiceManagement 
  = ServiceConfigurationFactory.CreateManagement<IOrganizationService>(
    new Uri("http ... Organization.svc"));
AuthenticationProviderType authenticationProvierType 
  = organizationServiceManagement.AuthenticationType;

Console.WriteLine(authenticationProvierType);
Console.ReadKey();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top