문제

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