internal VisualStudioCodeCredential(VisualStudioCodeCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client, IFileSystemService fileSystem, IVisualStudioCodeAdapter vscAdapter)
 {
     _tenantId   = options?.TenantId ?? "common";
     _pipeline   = pipeline ?? CredentialPipeline.GetInstance(options);
     _client     = client ?? new MsalPublicClient(_pipeline, options?.TenantId, ClientId, null, null);
     _fileSystem = fileSystem ?? FileSystemService.Default;
     _vscAdapter = vscAdapter ?? GetVscAdapter();
 }
Beispiel #2
0
        internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _clientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            _client = client ?? new MsalPublicClient(_pipeline, tenantId, clientId, null, options as ITokenCacheOptions);
        }
 internal VisualStudioCodeCredential(string tenantId, CredentialPipeline pipeline, MsalPublicClient client, IFileSystemService fileSystem, IVisualStudioCodeAdapter vscAdapter)
 {
     _tenantId   = tenantId ?? "common";
     _pipeline   = pipeline;
     _client     = client;
     _fileSystem = fileSystem ?? FileSystemService.Default;
     _vscAdapter = vscAdapter ?? GetVscAdapter();
 }
        internal UsernamePasswordCredential(string username, string password, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _username = username ?? throw new ArgumentNullException(nameof(username));

            _password = (password != null) ? password.ToSecureString() : throw new ArgumentNullException(nameof(password));

            _pipeline = pipeline;

            _client = client;
        }
        internal DeviceCodeCredential(Func <DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string clientId, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _clientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            _deviceCodeCallback = deviceCodeCallback ?? throw new ArgumentNullException(nameof(deviceCodeCallback));

            _pipeline = pipeline;

            _client = client;
        }
Beispiel #6
0
 internal VisualStudioCodeCredential(VisualStudioCodeCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client, IFileSystemService fileSystem,
                                     IVisualStudioCodeAdapter vscAdapter)
 {
     _tenantId   = options?.TenantId ?? _commonTenant;
     _pipeline   = pipeline ?? CredentialPipeline.GetInstance(options);
     Client      = client ?? new MsalPublicClient(_pipeline, options?.TenantId, ClientId, null, null, options?.IsLoggingPIIEnabled ?? false);
     _fileSystem = fileSystem ?? FileSystemService.Default;
     _vscAdapter = vscAdapter ?? GetVscAdapter();
     _allowMultiTenantAuthentication = options?.AllowMultiTenantAuthentication ?? false;
 }
Beispiel #7
0
        internal DeviceCodeCredential(Func <DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _clientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            _deviceCodeCallback = deviceCodeCallback ?? throw new ArgumentNullException(nameof(deviceCodeCallback));

            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            _client = client ?? new MsalPublicClient(_pipeline, tenantId, clientId, AzureAuthorityHosts.GetDeviceCodeRedirectUri(_pipeline.AuthorityHost).ToString(), options as ITokenCacheOptions);
        }
Beispiel #8
0
        internal InteractiveBrowserCredential(string tenantId, string clientId, CredentialPipeline pipeline, TokenCredentialOptions options)
        {
            if (clientId is null)
            {
                throw new ArgumentNullException(nameof(clientId));
            }

            _pipeline = pipeline;

            _client = _pipeline.CreateMsalPublicClient(clientId, tenantId, "http://localhost", options as ITokenCacheOptions);
        }
Beispiel #9
0
 internal SharedTokenCacheCredential(string tenantId, string username, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
 {
     _tenantId             = tenantId;
     _username             = username;
     _skipTenantValidation = (options as SharedTokenCacheCredentialOptions)?.EnableGuestTenantAuthentication ?? false;
     _record   = (options as SharedTokenCacheCredentialOptions)?.AuthenticationRecord;
     _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);
     _allowMultiTenantAuthentication = options?.AllowMultiTenantAuthentication ?? false;
     Client            = client ?? new MsalPublicClient(_pipeline, tenantId, (options as SharedTokenCacheCredentialOptions)?.ClientId ?? Constants.DeveloperSignOnClientId, null, (options as ITokenCacheOptions) ?? s_DefaultCacheOptions);
     _accountAsyncLock = new AsyncLockWithValue <IAccount>();
 }
        internal InteractiveBrowserCredential(string tenantId, string clientId, CredentialPipeline pipeline, bool attachSharedCache)
        {
            if (clientId is null)
            {
                throw new ArgumentNullException(nameof(clientId));
            }

            _pipeline = pipeline;

            _client = _pipeline.CreateMsalPublicClient(clientId, tenantId, "http://localhost", attachSharedCache);
        }
        internal SharedTokenCacheCredential(string tenantId, string username, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _tenantId = tenantId;

            _username = username;

            _pipeline = pipeline;

            _client = client;

            _account = new Lazy <Task <IAccount> >(GetAccountAsync);
        }
        internal UsernamePasswordCredential(string username, string password, string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _username = username ?? throw new ArgumentNullException(nameof(username));

            _password = (password != null) ? password.ToSecureString() : throw new ArgumentNullException(nameof(password));

            _clientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            Validations.ValidateTenantId(tenantId, nameof(tenantId));

            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            _client = client ?? new MsalPublicClient(_pipeline, tenantId, clientId, null, options as ITokenCacheOptions);
        }
Beispiel #13
0
        internal UsernamePasswordCredential(string username, string password, string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            Argument.AssertNotNull(username, nameof(username));
            Argument.AssertNotNull(password, nameof(password));
            Argument.AssertNotNull(clientId, nameof(clientId));
            _tenantId = Validations.ValidateTenantId(tenantId, nameof(tenantId));
            _allowMultiTenantAuthentication = options?.AllowMultiTenantAuthentication ?? false;

            _username = username;
            _password = password.ToSecureString();
            _clientId = clientId;
            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);
            _client   = client ?? new MsalPublicClient(_pipeline, tenantId, clientId, null, options as ITokenCacheOptions);
        }
        internal SharedTokenCacheCredential(string tenantId, string username, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _tenantId = tenantId;

            _username = username;

            _record = (options as SharedTokenCacheCredentialOptions)?.AuthenticationRecord;

            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            _client = client ?? new MsalPublicClient(_pipeline, tenantId, Constants.DeveloperSignOnClientId, null, (options as ITokenCacheOptions) ?? s_DefaultCacheOptions);

            _account = new Lazy <Task <IAccount> >(GetAccountAsync);
        }
Beispiel #15
0
        internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            Argument.AssertNotNull(clientId, nameof(clientId));

            ClientId  = clientId;
            _tenantId = tenantId;
            Pipeline  = pipeline ?? CredentialPipeline.GetInstance(options);
            LoginHint = (options as InteractiveBrowserCredentialOptions)?.LoginHint;
            var redirectUrl       = (options as InteractiveBrowserCredentialOptions)?.RedirectUri?.AbsoluteUri ?? Constants.DefaultRedirectUrl;
            var beforeBuildClient = (options as InteractiveBrowserCredentialOptions)?.BeforeBuildClient;

            Client = client ?? new MsalPublicClient(Pipeline, tenantId, clientId, redirectUrl, options, beforeBuildClient);
        }
        internal DeviceCodeCredential(Func <DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            Argument.AssertNotNull(clientId, nameof(clientId));
            Argument.AssertNotNull(deviceCodeCallback, nameof(deviceCodeCallback));

            _tenantId                      = tenantId;
            ClientId                       = clientId;
            DeviceCodeCallback             = deviceCodeCallback;
            DisableAutomaticAuthentication = (options as DeviceCodeCredentialOptions)?.DisableAutomaticAuthentication ?? false;
            Record   = (options as DeviceCodeCredentialOptions)?.AuthenticationRecord;
            Pipeline = pipeline ?? CredentialPipeline.GetInstance(options);
            Client   = client ?? new MsalPublicClient(
                Pipeline,
                tenantId,
                ClientId,
                AzureAuthorityHosts.GetDeviceCodeRedirectUri(Pipeline.AuthorityHost).AbsoluteUri,
                options as ITokenCacheOptions,
                options?.IsLoggingPIIEnabled ?? false);
        }
Beispiel #17
0
        internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            Pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            var redirectUrl = (options as InteractiveBrowserCredentialOptions)?.RedirectUri?.AbsoluteUri ?? Constants.DefaultRedirectUrl;

            Client = client ?? new MsalPublicClient(Pipeline, tenantId, clientId, redirectUrl, options as ITokenCacheOptions);
        }
        internal DeviceCodeCredential(Func <DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            DeviceCodeCallback = deviceCodeCallback ?? throw new ArgumentNullException(nameof(deviceCodeCallback));

            DisableAutomaticAuthentication = (options as DeviceCodeCredentialOptions)?.DisableAutomaticAuthentication ?? false;

            Record = (options as DeviceCodeCredentialOptions)?.AuthenticationRecord;

            Pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            Client = client ?? new MsalPublicClient(Pipeline, tenantId, ClientId, AzureAuthorityHosts.GetDeviceCodeRedirectUri(Pipeline.AuthorityHost).ToString(), options as ITokenCacheOptions);
        }
        internal InteractiveBrowserCredential(CredentialPipeline pipeline, MsalPublicClient client)
        {
            _pipeline = pipeline;

            _client = client;
        }
Beispiel #20
0
        internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            Argument.AssertNotNull(clientId, nameof(clientId));

            ClientId  = clientId;
            _tenantId = tenantId;
            _allowMultiTenantAuthentication = options?.AllowMultiTenantAuthentication ?? false;
            Pipeline  = pipeline ?? CredentialPipeline.GetInstance(options);
            LoginHint = (options as InteractiveBrowserCredentialOptions)?.LoginHint;
            var redirectUrl = (options as InteractiveBrowserCredentialOptions)?.RedirectUri?.AbsoluteUri ?? Constants.DefaultRedirectUrl;

            Client = client ?? new MsalPublicClient(Pipeline, tenantId, clientId, redirectUrl, options as ITokenCacheOptions, options?.IsLoggingPIIEnabled ?? false);
        }