public AzureResourceManagerClient(
     IHttpClient httpClient,
     AppConfig config,
     IUserManagementClient userManagementClient)
 {
     this.httpClient           = httpClient;
     this.userManagementClient = userManagementClient;
     this.config = config;
 }
 public StatusService(
     AppConfig config,
     IStorageAdapterClient storageAdapter,
     IUserManagementClient userManagement,
     IAppConfigurationClient appConfig)
     : base(config)
 {
     this.Dependencies = new Dictionary <string, IStatusOperation>
     {
         { "Storage Adapter", storageAdapter },
         { "User Management", userManagement },
         { "App Config", appConfig },
     };
 }
示例#3
0
        public AuthMiddleware(
            // ReSharper disable once UnusedParameter.Local
            RequestDelegate requestDelegate, // Required by ASP.NET
            IConfigurationManager <OpenIdConnectConfiguration> openIdCfgMan,
            IClientAuthConfig config,
            IUserManagementClient userManagementClient,
            ILogger log)
        {
            this.requestDelegate            = requestDelegate;
            this.openIdCfgMan               = openIdCfgMan;
            this.config                     = config;
            this.log                        = log;
            this.authRequired               = config.AuthRequired;
            this.tokenValidationInitialized = false;
            this.tokenValidationExpiration  = DateTime.UtcNow;
            this.userManagementClient       = userManagementClient;

            // This will show in development mode, or in case auth is turned off
            if (!this.authRequired)
            {
                this.log.Warn("### AUTHENTICATION IS DISABLED! ###", () => { });
                this.log.Warn("### AUTHENTICATION IS DISABLED! ###", () => { });
                this.log.Warn("### AUTHENTICATION IS DISABLED! ###", () => { });
            }
            else
            {
                this.log.Info("Auth config", () => new
                {
                    this.config.AuthType,
                    this.config.JwtIssuer,
                    this.config.JwtAudience,
                    this.config.JwtAllowedAlgos,
                    this.config.JwtClockSkew,
                    this.config.OpenIdTimeToLive
                });

                this.InitializeTokenValidationAsync(CancellationToken.None).Wait();
            }

            // TODO ~devis: this is a temporary solution for public preview only
            // TODO ~devis: remove this approach and use the service to service authentication
            // https://github.com/Azure/pcs-auth-dotnet/issues/18
            // https://github.com/Azure/azure-iot-pcs-remote-monitoring-dotnet/issues/11
            this.log.Warn("### Service to service authentication is not available in public preview ###", () => { });
            this.log.Warn("### Service to service authentication is not available in public preview ###", () => { });
            this.log.Warn("### Service to service authentication is not available in public preview ###", () => { });
        }
示例#4
0
        public AuthMiddleware(
            RequestDelegate requestDelegate,
            IConfigurationManager <OpenIdConnectConfiguration> openIdCfgMan,
            AppConfig config,
            IUserManagementClient userManagementClient,
            ILogger <AuthMiddleware> logger,
            ILoggerFactory loggerFactory)
        {
            this.requestDelegate            = requestDelegate;
            this.openIdCfgMan               = openIdCfgMan;
            this.config                     = config;
            this.logger                     = logger;
            this.loggerFactory              = loggerFactory;
            this.authRequired               = this.config.Global.AuthRequired;
            this.rolesConfig                = this.config.Global.ClientAuth.Roles;
            this.tokenValidationInitialized = false;
            this.userManagementClient       = userManagementClient;
            this.permissions                = this.GetPermissions();

            // This will show in development mode, or in case auth is turned off
            if (!this.authRequired)
            {
                this.logger.LogWarning("### AUTHENTICATION IS DISABLED! ###");
                this.logger.LogWarning("### AUTHENTICATION IS DISABLED! ###");
                this.logger.LogWarning("### AUTHENTICATION IS DISABLED! ###");
            }
            else
            {
                this.logger.LogInformation("Auth config is {config}", this.config);
                this.InitializeTokenValidationAsync(CancellationToken.None).Wait();
            }

            // TODO ~devis: this is a temporary solution for public preview only
            // TODO ~devis: remove this approach and use the service to service authentication
            // https://github.com/Azure/pcs-auth-dotnet/issues/18
            // https://github.com/Azure/azure-iot-pcs-remote-monitoring-dotnet/issues/11
            this.logger.LogWarning("### Service to service authentication is not available in public preview ###");
            this.logger.LogWarning("### Service to service authentication is not available in public preview ###");
            this.logger.LogWarning("### Service to service authentication is not available in public preview ###");
        }
 public AuthAdminController(IUserManagementClient userManagementClient, ILogger <AccountController> logger)
 {
     _userManagementClient = userManagementClient;
     _logger = logger;
 }
 public AccountController(IUserManagementClient userManagementClient)
 {
     _userManagementClient = userManagementClient;
 }
 public NewRankingSnapshotEventHandler(IUserManagementClient userManagementClient, IRankingSnapshotCommandRepository repository)
 {
     _userManagementClient = userManagementClient;
     _repository           = repository;
 }
 public ClaimsTransformer(IUserManagementClient userManagementClient)
 {
     _userManagementClient = userManagementClient;
 }