public AzureAd(GrouperConfiguration config) : this( tenantId : config.AzureAdTenantId, clientId : config.AzureAdClientId, clientSecret : config.AzureAdClientSecret, clientSecretIsDpapiProtected : config.AzureAdClientSecretIsDpapiProtected) { }
public static Grouper CreateFromConfig(GrouperConfiguration config) { Grouper grouper = new Grouper(config.ChangeRatioLowerLimit); if (config.AzureAdRole != null && config.AzureAdRole.Length > 0) { AzureAd az = new AzureAd(config); if (config.AzureAdHasRole(GrouperConfiguration.Role.GroupStore)) { grouper.AddGroupStore(az); } if (config.ExchangeHasRole(GrouperConfiguration.Role.MemberSource)) { grouper.AddMemberSource(az); } if (config.AzureAdHasRole(GrouperConfiguration.Role.GroupOwnerSource)) { grouper.AddGroupOwnerSource(az); } } if (config.ExchangeRole != null && config.ExchangeRole.Length > 0) { Exo exo = new Exo(config); if (config.ExchangeHasRole(GrouperConfiguration.Role.GroupStore)) { grouper.AddGroupStore(exo); } if (config.ExchangeHasRole(GrouperConfiguration.Role.MemberSource)) { grouper.AddMemberSource(exo); } } if (config.OnPremAdHasRole(GrouperConfiguration.Role.GroupStore)) { OnPremAd onPremAd = new OnPremAd(config); if (config.OnPremAdHasRole(GrouperConfiguration.Role.GroupStore)) { grouper.AddGroupStore(onPremAd); } if (config.OnPremAdHasRole(GrouperConfiguration.Role.MemberSource)) { grouper.AddMemberSource(onPremAd); } } if (!string.IsNullOrEmpty(config.MemberDatabaseConnectionString)) { grouper.AddMemberSource(new MemberDb(config)); } if (!string.IsNullOrEmpty(config.LogDatabaseConnectionString)) { grouper.AddLogger(new LogDb(config)); } if (!string.IsNullOrEmpty(config.OpenEDatabaseConnectionString)) { grouper.AddGroupStore(new OpenE(config)); } return(grouper); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers() .AddNewtonsoftJson(); services.Configure <GrouperConfiguration>(Configuration.GetSection("Grouper")); GrouperConfiguration config = new GrouperConfiguration(); ConfigurationBinder.Bind(Configuration.GetSection("Grouper"), config); services.AddSingleton <IStringResourceHelper, StringResourceHelper>(); services.AddSingleton((_) => { return(Grouper.CreateFromConfig(config)); }); }
public OnPremAd(string userName, string password, bool passwordIsDpapiProtected) { // userName and password are optional if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password)) { _userName = userName; _password = GrouperConfiguration.GetSensitiveString(password, passwordIsDpapiProtected); } _dnCache = MemoryCache.Default; _cachePolicy = new CacheItemPolicy() { SlidingExpiration = TimeSpan.FromMinutes(30), }; }
public Exo(string userName, string password, bool passwordIsDpapiProtected) { if (string.IsNullOrEmpty(userName)) { throw new ArgumentNullException(nameof(userName)); } if (string.IsNullOrEmpty(password)) { throw new ArgumentNullException(nameof(password)); } string plaintextPassword = GrouperConfiguration.GetSensitiveString(password, passwordIsDpapiProtected); SecureString securePassword = new SecureString(); foreach (char c in plaintextPassword) { securePassword.AppendChar(c); } _credential = new PSCredential(userName, securePassword); }
public AzureAd(string tenantId, string clientId, string clientSecret, bool clientSecretIsDpapiProtected) { if (!Guid.TryParse(tenantId, out _)) { throw new ArgumentException(nameof(tenantId), "Argument is not a valid GUID."); } if (!Guid.TryParse(clientId, out _)) { throw new ArgumentException(nameof(clientId), "Argument is not a valid GUID."); } if (string.IsNullOrEmpty(clientSecret)) { throw new ArgumentNullException(nameof(clientSecret)); } _clientId = clientId; _clientSecret = GrouperConfiguration.GetSensitiveString(clientSecret, clientSecretIsDpapiProtected); _authorityUri = new Uri($"https://login.microsoftonline.com/{tenantId}"); }
public GrouperController(Microsoft.Extensions.Options.IOptions <GrouperConfiguration> config) { _config = config.Value ?? throw new ArgumentNullException(); }
public DocumentController(IOptions <GrouperConfiguration> config, Grouper grouper, IStringResourceHelper stringResourceHelper) { _config = config.Value ?? throw new ArgumentNullException(); _stringResourceHelper = stringResourceHelper; _grouperBackend = grouper ?? throw new ArgumentNullException(nameof(grouper)); }
public DocumentDb(GrouperConfiguration configuration, string author) : this(configuration.DocumentDatabaseConnectionString, author) { }
public Exo(GrouperConfiguration config) : this( userName : config.ExchangeUserName, password : config.ExchangePassword, passwordIsDpapiProtected : config.ExchangePasswordIsDpapiProtected) { }
public AuditLogController(IOptions <GrouperConfiguration> config) { _config = config.Value ?? throw new ArgumentNullException(); }
public OnPremAd(GrouperConfiguration config) : this( userName : config.OnPremAdUserName, password : config.OnPremAdPassword, passwordIsDpapiProtected : config.OnPremAdPasswordIsDpapiProtected) { }
public Worker(EventLog eventLog) { _eventLog = eventLog ?? throw new ArgumentNullException(nameof(eventLog)); _config = GrouperConfiguration.CreateFromAppSettings(ConfigurationManager.AppSettings); }
public OpenE(GrouperConfiguration config) : this(config.OpenEDatabaseConnectionString) { }
public MemberDb(GrouperConfiguration configuration) : this(configuration.MemberDatabaseConnectionString) { }
public LogDb(GrouperConfiguration configuration) : this(configuration.LogDatabaseConnectionString) { }
public Worker() { _config = GrouperConfiguration.CreateFromAppSettings(ConfigurationManager.AppSettings); }