Exemple #1
0
        public virtual Task <ServiceInformation> CreateServiceInfo(AppConfig appConfig, CredentialType credentialType)
        {
            var activeDirectoryServiceInfo = new AdalServiceInformation
            {
                ClientID        = appConfig.ClientID,
                ClientSecret    = appConfig.ClientSecret,
                Tenant          = appConfig.TenantDomain,
                ServiceResource = appConfig.ServiceResource
            };

            if (credentialType == CredentialType.Certificate)
            {
                activeDirectoryServiceInfo.AuthenticationProvider = this.AuthenticationProvider ?? new AdalCertificateAuthenticationProvider(activeDirectoryServiceInfo);
            }
            else
            {
                activeDirectoryServiceInfo.AuthenticationProvider = this.AuthenticationProvider ?? new AdalClientAuthenticationProvider(activeDirectoryServiceInfo);
            }

            return(Task.FromResult <ServiceInformation>(activeDirectoryServiceInfo));
        }
        public virtual Task<ServiceInformation> CreateServiceInfo(AppConfig appConfig, CredentialType credentialType)
        {
            var activeDirectoryServiceInfo = new AdalServiceInformation
            {
                ClientID = appConfig.ClientID,
                ClientSecret = appConfig.ClientSecret,
                Tenant = appConfig.TenantDomain,
                ServiceResource = appConfig.ServiceResource
            };

            if (credentialType == CredentialType.Certificate)
            {
                activeDirectoryServiceInfo.AuthenticationProvider = this.AuthenticationProvider ?? new AdalCertificateAuthenticationProvider(activeDirectoryServiceInfo);
            }
            else
            {
                activeDirectoryServiceInfo.AuthenticationProvider = this.AuthenticationProvider ?? new AdalClientAuthenticationProvider(activeDirectoryServiceInfo);
            }

            return Task.FromResult<ServiceInformation>(activeDirectoryServiceInfo);
        }