コード例 #1
0
ファイル: Program.cs プロジェクト: thnetii/msal-extensions
        private static void BindCommandLineScopes(AcquireTokenOptions options,
                                                  ParseResult parseResult)
        {
            var scopesOptionResult = parseResult.CommandResult.Children
                                     .OfType <OptionResult>()
                                     .FirstOrDefault(r => r.Symbol.Name == nameof(options.Scopes));

            if (scopesOptionResult?.GetValueOrDefault() is IEnumerable <string> scopes)
            {
                options.Scopes.AddRange(scopes);
            }
        }
コード例 #2
0
        public DeviceCodeCommandExecutor(
            ClientApplicationFactory clientApplicationFactory,
            IOptions <AcquireTokenOptions> acquireTokenOptions,
            ILoggerFactory?loggerFactory = null)
            : base(clientApplicationFactory, loggerFactory)
        {
            this.acquireTokenOptions = acquireTokenOptions?.Value
                                       ?? throw new ArgumentNullException(nameof(acquireTokenOptions));
            loggerFactory ??= Microsoft.Extensions.Logging.Abstractions
            .NullLoggerFactory.Instance;

            string deviceCodeCategory = typeof(DeviceCodeResult).Namespace +
                                        "." + nameof(DeviceCodeResult.DeviceCode);

            deviceCodeLogger = loggerFactory.CreateLogger(deviceCodeCategory);

            deviceCodeResultCallback = DeviceCodeUserInteractionCallback;
        }