Esempio n. 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));
        }
Esempio n. 2
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);
        }