public void FindScopesAsync_WhenScopeHasClaims_ExpectScopeAndClaimsReturned(DbContextOptions <ConfigurationDbContext> options) { var scope = CreateTestObject(); using (var context = new ConfigurationDbContext(options, StoreOptions)) { context.Scopes.Add(scope.ToEntity()); context.SaveChanges(); } IList <Scope> scopes; using (var context = new ConfigurationDbContext(options, StoreOptions)) { var store = new ScopeStore(context, FakeLogger <ScopeStore> .Create()); scopes = store.FindScopesAsync(new List <string> { scope.Name }).Result.ToList(); } Assert.NotNull(scopes); var foundScope = scopes.Single(); Assert.NotNull(foundScope.Claims); Assert.NotEmpty(foundScope.Claims); }
public void FindScopesAsync_WhenScopesExist_ExpectScopesReturned(DbContextOptions <ConfigurationDbContext> options) { var firstTestScope = CreateTestObject(); var secondTestScope = CreateTestObject(); using (var context = new ConfigurationDbContext(options, StoreOptions)) { context.Scopes.Add(firstTestScope.ToEntity()); context.Scopes.Add(secondTestScope.ToEntity()); context.SaveChanges(); } IList <Scope> scopes; using (var context = new ConfigurationDbContext(options, StoreOptions)) { var store = new ScopeStore(context, FakeLogger <ScopeStore> .Create()); scopes = store.FindScopesAsync(new List <string> { firstTestScope.Name, secondTestScope.Name }).Result.ToList(); } Assert.NotNull(scopes); Assert.NotEmpty(scopes); Assert.NotNull(scopes.FirstOrDefault(x => x.Name == firstTestScope.Name)); Assert.NotNull(scopes.FirstOrDefault(x => x.Name == secondTestScope.Name)); }
public void Setup() { base.Setup(); _clientStore = new ClientStore(StoreSettings.UsingFolder(TargetFolder)); _tokenHandleStore = new TokenHandleStore(StoreSettings.UsingFolder(TargetFolder)); _scopeStore = new ScopeStore(StoreSettings.UsingFolder(TargetFolder)); }
public async Task CanFindMultipleScopes() { var store = new ScopeStore(Session); var result = await store.FindScopesAsync(new[] { "read", "write" }); result.Count().ShouldBe(2); }
public AdminService(IMongoClient client, IMongoDatabase db, StoreSettings settings) { _client = client; _db = db; _settings = settings; _clientSerializer = new ClientSerializer(); _clientStore = new ClientStore(db, settings, _clientSerializer); _scopeStore = new ScopeStore(db, settings); }
public async Task CanFindExactName() { var store = new ScopeStore(Session); var result = (await store.FindScopesAsync(new[] { "read" })).ToArray(); result.Count().ShouldBe(1); result.First().Name.ShouldBe("read"); }
public async Task GetScopesAsync_Test() { var store = new ScopeStore(options); var scopes = await store.GetScopesAsync(); Assert.Equal <int>(2, scopes.Count()); scopes = await store.GetScopesAsync(false); Assert.Equal <int>(3, scopes.Count()); }
/// <summary> /// Check whether the specified resource access delegate scope(s) is (are) valid. /// </summary> /// <param name="context">The authorization endpoint specific context.</param> /// <returns>The task to check whether the specified resource access delegate scope(s) is (are) valid.</returns> /// <exception cref="ArgumentNullException">Specified <paramref name="context"/> is null.</exception> protected virtual async Task ValidateScopesAsync(AuthorizationContext context) { var validScopes = (await ScopeStore.GetAllAsync()).Select(it => it.Id); var except = context.Scopes.Except(validScopes); if (except.Any()) { context.Failed(OAuthErrors.InvalidScope.InvalidScope, except.First()); return; } }
static List <AuthorizationCodeHandleRecord> InsertTestData(ClientStore clientStore, ScopeStore scopeStore, AuthorizationCodeStore authorizationCodeStore, TokenHandleStore ths, int count = 1) { var tokenInsert = TokenHandleStoreTest.InsertTestData(clientStore, scopeStore, ths, 10); var clientId = tokenInsert[0].Record.ClientId; string subjectSeed = Guid.NewGuid().ToString(); List <AuthorizationCodeHandleRecord> result = new List <AuthorizationCodeHandleRecord>(); int i = 0; foreach (var tokenRecord in tokenInsert) { var client = clientStore.FindClientByIdAsync(tokenRecord.Record.ClientId); AuthorizationCodeHandle handle = new AuthorizationCodeHandle { ClientId = tokenRecord.Record.ClientId, SubjectId = tokenRecord.Record.SubjectId, Expires = DateTimeOffset.UtcNow.AddMinutes(5), CreationTime = DateTimeOffset.UtcNow, IsOpenId = true, RedirectUri = "REDIRECTURI/" + i, WasConsentShown = true, Nonce = "NONCE:" + i, ClaimIdentityRecords = new List <ClaimIdentityRecord>() { new ClaimIdentityRecord() { AuthenticationType = Constants.PrimaryAuthenticationType, ClaimTypeRecords = new List <ClaimTypeRecord>() { new ClaimTypeRecord() { Type = Constants.ClaimTypes.Subject, Value = tokenRecord.Record.SubjectId, ValueType = "VALUETYPE:" + i } } } }, RequestedScopes = client.Result.AllowedScopes, Key = Guid.NewGuid().ToString(), }; var handleRecord = new AuthorizationCodeHandleRecord(handle); authorizationCodeStore.CreateAsync(handleRecord.Record); result.Add(handleRecord); ++i; } return(result); }
public SetupController( Contexts.IDS4Context context, LuigiTrabacchin.IdentityServer4.EntityFramework.Identity.UserManager<Int32> userManager, ScopeStore<Int32> scopeStore, ClientStore<Int32> clientStore ) { this.Context = context; this._userManager = userManager; this._scopeStore = scopeStore; this._clientStore = clientStore; }
public async Task FindScopesAsync_Test() { var store = new ScopeStore(options); var scopes = await store.FindScopesAsync(null); Assert.Equal <int>(3, scopes.Count()); scopes = await store.FindScopesAsync(new List <string> { "scope1" }); Assert.Equal <int>(1, scopes.Count()); }
public void Configuration(IAppBuilder app) { var factory = new IdentityServerServiceFactory(); factory.UseInMemoryUsers(new List <InMemoryUser>()); var clientStore = new ClientStore(); var scopeStore = new ScopeStore(); factory.ClientStore = new Registration <IClientStore>(resolver => clientStore); factory.ScopeStore = new Registration <IScopeStore>(resolver => scopeStore); var options = new IdentityServerOptions { SiteName = "Embedded IdentityServer", Factory = factory }; options.RequireSsl = false; app.UseIdentityServer(options); // accept access tokens from identityserver and require a scope of 'api1' app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions { Authority = "http://localhost:49921", ValidationMode = ValidationMode.ValidationEndpoint, RequiredScopes = new[] { "api" } }); // configure web api var config = new HttpConfiguration(); config.MapHttpAttributeRoutes(); // require authentication for all controllers config.Filters.Add(new AuthorizeAttribute()); app.UseWebApi(config); }
protected override void ProcessRecord() { IEnumerable <Scope> scopes; if (Predefined) { scopes = StandardScopes.All; } else { scopes = ScopeStore.GetScopesAsync().Result; } foreach (var scope in scopes) { WriteObject(scope); } }
protected override void ProcessRecord() { IEnumerable <Scope> scopes; if (Predefined) { var builtin = BuiltInScopes(); scopes = builtin; } else { scopes = ScopeStore.GetScopesAsync().Result; } foreach (var scope in scopes) { WriteObject(scope); } }
public async Task FindScopesAsync() { //Arrange var sut = new ScopeStore(NhibernateSession); var testScope1 = ObjectCreator.GetScope(); var testScope2 = ObjectCreator.GetScope(); var testScope3 = ObjectCreator.GetScope(); var testScope1Entity = testScope1.ToEntity(); var testScope2Entity = testScope2.ToEntity(); var testScope3Entity = testScope3.ToEntity(); ExecuteInTransaction(session => { session.Save(testScope1Entity); session.Save(testScope2Entity); session.Save(testScope3Entity); }); //Act var result = (await sut.FindScopesAsync(new List <string> { testScope1.Name, testScope2.Name })) .ToList(); var scopeNames = result.Select(s => s.Name).ToList(); //Assert Assert.Contains(testScope1.Name, scopeNames); Assert.Contains(testScope2.Name, scopeNames); Assert.DoesNotContain(testScope3.Name, scopeNames); //CleanUp ExecuteInTransaction(session => { session.Delete(testScope1Entity); session.Delete(testScope2Entity); session.Delete(testScope3Entity); }); }
public async Task GetScopesAsync() { //Arrange var sut = new ScopeStore(NhibernateSession); var testScope1 = ObjectCreator.GetScope(); var testScope2 = ObjectCreator.GetScope(); var testScope3 = ObjectCreator.GetScope(); var testScope1Entity = testScope1.ToEntity(); var testScope2Entity = testScope2.ToEntity(); var testScope3Entity = testScope3.ToEntity(); testScope1Entity.ShowInDiscoveryDocument = true; testScope2Entity.ShowInDiscoveryDocument = true; testScope3Entity.ShowInDiscoveryDocument = false; ExecuteInTransaction(session => { session.Save(testScope1Entity); session.Save(testScope2Entity); session.Save(testScope3Entity); }); //Act var result = (await sut.GetScopesAsync()) .ToList(); var scopeNames = result.Select(s => s.Name).ToList(); //Assert Assert.Contains(testScope1.Name, scopeNames); Assert.Contains(testScope2.Name, scopeNames); Assert.DoesNotContain(testScope3.Name, scopeNames); //CleanUp ExecuteInTransaction(session => { session.Delete(testScope1Entity); session.Delete(testScope2Entity); session.Delete(testScope3Entity); }); }
public static List <ScopeRecord> InsertTestData(ScopeStore store, int count = 1) { List <ScopeRecord> scopeRecords = new List <ScopeRecord>(); for (int i = 0; i < count; ++i) { Scope record = new Scope() { Name = "SCOPENAME:" + i, AllowUnrestrictedIntrospection = true, Claims = new List <ScopeClaim> { new ScopeClaim() { AlwaysIncludeInIdToken = true, Description = "SCOPECLAIMDESCRIPTION:" + i, Name = "SCOPECLAIMNAME:" + i } }, ClaimsRule = "CLAIMSRULE:" + i, Description = "CLAIMSRULE:" + i, DisplayName = "DISPLAYNAME:" + i, Emphasize = true, Enabled = true, IncludeAllClaimsForUser = true, Required = true, ScopeSecrets = new List <Secret>() { new Secret("SECRET:" + i), new Secret("SECRET:" + i) }, ShowInDiscoveryDocument = (i % 2 == 1) }; var scopeRecord = new ScopeRecord(new ScopeHandle(record)); store.CreateAsync(scopeRecord.Record); scopeRecords.Add(scopeRecord); } return(scopeRecords); }
public void GetScopesAsync_WhenAllScopesRequested_ExpectAllScopes(DbContextOptions <ConfigurationDbContext> options) { using (var context = new ConfigurationDbContext(options, StoreOptions)) { context.Scopes.Add(CreateTestObject().ToEntity()); context.Scopes.Add(new Entities.Scope { Name = "hidden_scope_return", ShowInDiscoveryDocument = false }); context.SaveChanges(); } IList <Scope> scopes; using (var context = new ConfigurationDbContext(options, StoreOptions)) { var store = new ScopeStore(context, FakeLogger <ScopeStore> .Create()); scopes = store.GetScopesAsync(false).Result.ToList(); } Assert.NotNull(scopes); Assert.NotEmpty(scopes); Assert.True(scopes.Any(x => !x.ShowInDiscoveryDocument)); }
public static List <TokenHandleRecord> InsertTestData(ClientStore clientStore, ScopeStore scopeStore, TokenHandleStore store, int count = 1) { var subjectSeed = Guid.NewGuid().ToString(); var clientInsert = ClientStoreTest.InsertTestData(clientStore, scopeStore, 1); List <TokenHandleRecord> result = new List <TokenHandleRecord>(); for (int i = 0; i < count; ++i) { var tokenHandle = MakeTokenHandle(subjectSeed, i); tokenHandle.ClientId = clientInsert[0].Record.ClientId; var tokenHandleRecord = new TokenHandleRecord(tokenHandle); store.CreateAsync(tokenHandleRecord.Record); result.Add(tokenHandleRecord); } return(result); }
public void Configuration(IAppBuilder app) { string _domain_root = ConfigurationManager.AppSettings["IdentityServer:Domain"]; IdentityServerSettings.DomainRoot = _domain_root; Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Trace() .CreateLogger(); var builder = new ContainerBuilder(); ConfigureAuth(app); var path = HostingEnvironment.MapPath("~/App_Data"); var cassandraUserStore = new CassandraUserStore(CassandraAspNetIdentityOptions.CassandraConfig, CassandraAspNetApplicationConstants.TenantGuid); var userService = new Registration <IUserService>(new AspNetIdentityServerService(cassandraUserStore)); userService = new Registration <IUserService>(new ArbitraryUserService()); IdentityServerServiceFactory identityServerServiceFactory; #if CASSANDRA_STORE app.UseAspNetCassandraStores(new CassandraOptions() { ContactPoints = new List <string> { "cassandra" }, Credentials = new CassandraCredentials() { Password = "", UserName = "" }, KeySpace = "aspnetidentity" }); app.UseIdentityServerCassandraStores(userService, out identityServerServiceFactory, new CassandraOptions() { ContactPoints = new List <string> { "cassandra" }, Credentials = new CassandraCredentials() { Password = "", UserName = "" }, KeySpace = "identityserver3" }); /* * TODO: Cassandra may be down, need a robust app that can reconnect * foreach (var client in Clients.Get()) * { * IdentityServer3CassandraDao.UpsertClientAsync( * new FlattenedClientRecord(new FlattenedClientHandle(client))); * } * foreach (var scope in Scopes.Get()) * { * IdentityServer3CassandraDao.UpsertScopeAsync(new FlattenedScopeRecord(new FlattenedScopeHandle(scope))); * } * */ #endif #if BIGGY_STORE // Create and modify default settings StoreSettings settings = StoreSettings.DefaultSettings; settings.Folder = path; ClientStore myClientStore = new ClientStore(settings); foreach (var client in Clients.Get()) { myClientStore.CreateAsync(new ClientHandle(client)); } ScopeStore myScopeStore = new ScopeStore(settings); foreach (var scope in Scopes.Get()) { myScopeStore.CreateAsync(new ScopeHandle(scope)); } // Create the BiggyIdentityService factory identityServerServiceFactory = new ServiceFactory(userService, settings); #endif identityServerServiceFactory.Register(new Registration <IDictionary <string, IClaimsProvider> >(resolver => { var result = new Dictionary <string, IClaimsProvider> { { CustomClaimsProviderHub.WellKnown_DefaultProviderName, new DefaultClaimsProvider(resolver.Resolve <IUserService>()) }, { "openid-provider", new CustomOpenIdClaimsProvider(resolver.Resolve <IUserService>()) }, { "arbitrary-provider", new ArbitraryClaimsProvider(resolver.Resolve <IUserService>()) } }; return(result); })); identityServerServiceFactory.ClaimsProvider = new Registration <IClaimsProvider>(typeof(CustomClaimsProviderHub)); var options = new IdentityServerOptions { Factory = identityServerServiceFactory, RequireSsl = false, SigningCertificate = Certificate.Get(), SiteName = "P5 IdentityServer3" }; app.Map("/idsrv3core", idsrvApp => { idsrvApp.UseIdentityServer(options); }); app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions { Authority = "http://localhost:55970/idsrv3core", ValidationMode = ValidationMode.ValidationEndpoint, RequiredScopes = new[] { "api1" }, PreserveAccessToken = true, EnableValidationResultCache = true }); HttpConfiguration config = new HttpConfiguration(); /* config.Routes.MapHttpRoute( * name: "DefaultApi", * routeTemplate: "api/{controller}/{id}", * defaults: new {id = RouteParameter.Optional} * ); */ // Register your Web API controllers. builder.RegisterApiControllers(Assembly.GetExecutingAssembly()); builder.RegisterType <ApplicationUserManager>(); // Run other optional steps, like registering filters, // per-controller-type services, etc., then set the dependency resolver // to be Autofac. var container = builder.Build(); config.DependencyResolver = new AutofacWebApiDependencyResolver(container); config.Services.Replace(typeof(IAssembliesResolver), new WebApi2HubAssembliesResolver()); WebApiConfig.Register(config); // NEW way // OWIN WEB API SETUP: // Register the Autofac middleware FIRST, then the Autofac Web API middleware, // and finally the standard Web API middleware. app.UseAutofacMiddleware(container); app.UseAutofacWebApi(config); app.UseWebApi(config); }
public static List <RefreshTokenHandleRecord> InsertTestData(ClientStore clientStore, ScopeStore scopeStore, TokenHandleStore ths, RefreshTokenStore store, int count = 1) { List <RefreshTokenHandleRecord> result = new List <RefreshTokenHandleRecord>(); var insert = TokenHandleStoreTest.InsertTestData(clientStore, scopeStore, ths, count); var subjectSeed = Guid.NewGuid().ToString(); var clientId = insert[0].Record.ClientId; foreach (var item in insert) { RefreshTokenHandle tokenHandle = new RefreshTokenHandle { ClientId = clientId, AccessToken = item.Record, CreationTime = DateTimeOffset.UtcNow, Key = Guid.NewGuid().ToString(), Expires = DateTimeOffset.UtcNow.AddMinutes(5), LifeTime = 5, SubjectId = item.Record.SubjectId, Version = 1 }; var tokenHandleRecord = new RefreshTokenHandleRecord(tokenHandle); store.CreateAsync(tokenHandleRecord.Record); result.Add(tokenHandleRecord); } return(result); }
public static List <ClientRecord> InsertTestData(ClientStore store, ScopeStore scopeStore, int count = 1) { var scopeInsert = ScopeStoreTest.InsertTestData(scopeStore, 10); List <ClientRecord> result = new List <ClientRecord>(); for (int i = 0; i < count; ++i) { var scopes = from item in scopeInsert select item.Record.Name; Client record = new Client() { ClientId = Guid.NewGuid().ToString(), AbsoluteRefreshTokenLifetime = 5, AccessTokenLifetime = 5, AccessTokenType = AccessTokenType.Jwt, AllowAccessToAllCustomGrantTypes = true, AllowAccessToAllScopes = true, AllowAccessTokensViaBrowser = true, AllowClientCredentialsOnly = true, AllowRememberConsent = true, AllowedCorsOrigins = new List <string>() { "www.google,com", "www.microsoft.com" }, AllowedCustomGrantTypes = new List <string>() { "AllowedCustomGrantTypes" + i }, AllowedScopes = scopes.ToList(), AlwaysSendClientClaims = true, AuthorizationCodeLifetime = 5, Claims = new List <Claim>() { new Claim("Type:" + i, "Value:" + i) }, ClientName = "CLIENTNAME:" + i, ClientSecrets = new List <Secret>() { new Secret("Secret:" + i) }, ClientUri = "www.someuri.com/" + i, Enabled = true, EnableLocalLogin = true, Flow = Flows.ClientCredentials, IdentityProviderRestrictions = new List <string>() { "IPR:" + i }, IdentityTokenLifetime = 5, IncludeJwtId = true, LogoUri = "LogoUri.com/" + i, LogoutSessionRequired = true, LogoutUri = "LogoutUri.com/" + i, PostLogoutRedirectUris = new List <string>() { "PLRUri.com/" + i }, PrefixClientClaims = true, RedirectUris = new List <string>() { "RedirectUri.com/" + i }, RefreshTokenExpiration = TokenExpiration.Absolute, RefreshTokenUsage = TokenUsage.ReUse, RequireConsent = true, RequireSignOutPrompt = true, SlidingRefreshTokenLifetime = 5, UpdateAccessTokenClaimsOnRefresh = true }; var clientRecord = new ClientRecord(record.ToClientHandle()); store.CreateAsync(clientRecord.Record); result.Add(clientRecord); } return(result); }
public void Configuration(IAppBuilder app) { ConfigureAuth(app); var path = HostingEnvironment.MapPath("~/App_Data"); var userService = new Registration <IUserService>(new UserServiceBase()); var inMemoryFactory = new IdentityServerServiceFactory() .UseInMemoryClients(Clients.Get()) .UseInMemoryScopes(Scopes.Get()) .UseInMemoryUsers(Users.Get()); // Create and modify default settings StoreSettings settings = StoreSettings.DefaultSettings; settings.Folder = path; ClientStore myClientStore = new ClientStore(settings); foreach (var client in Clients.Get()) { myClientStore.CreateAsync(new ClientHandle(client)); } ScopeStore myScopeStore = new ScopeStore(settings); foreach (var scope in Scopes.Get()) { myScopeStore.CreateAsync(new ScopeHandle(scope)); } // Create the BiggyIdentityService factory var factory = new ServiceFactory(userService, settings); factory.UseInMemoryUsers(Users.Get()); factory.CustomGrantValidators.Add( new Registration <ICustomGrantValidator>(typeof(CustomGrantValidator))); factory.CustomGrantValidators.Add( new Registration <ICustomGrantValidator>(typeof(ActAsGrantValidator))); factory.ClaimsProvider = new Registration <IClaimsProvider>(typeof(CustomClaimsProvider)); var options = new IdentityServerOptions { Factory = factory, RequireSsl = false, // SigningCertificate = Certificate.Get(), SiteName = "P5 IdentityServer3" }; app.Map("/idsrv3core", idsrvApp => { idsrvApp.UseIdentityServer(options); }); app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions { Authority = "http://localhost:33854/idsrv3core", ValidationMode = ValidationMode.ValidationEndpoint, RequiredScopes = new[] { "CustomWebApi1", "api1", "WebApi1", "WebApi2", "read" }, PreserveAccessToken = true }); HttpConfiguration config = new HttpConfiguration(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); app.UseWebApi(config); }
public void Setup() { base.Setup(); _scopeStore = new ScopeStore(StoreSettings.UsingFolder(TargetFolder)); InsertTestData(_scopeStore, 10); }
// ############################################################################################# // Constructors // ############################################################################################# /** **************************************************************************************** * Constructs a new, empty Lox with the given \p name. * The name is immutable and all \b %Lox objects registered with ALox must be unique. * The name \c "Log" is reserved for the internal default singleton used for debug-logging. * In addition, name \c "GLOBAL" is not allowed. * * If parameter \p register is \c true (the default), static method * \ref cs::aworx::lox::ALox::Register "ALox.Register" is invoked and the object will be * retrievable with static method * \ref cs::aworx::lox::ALox::Get "ALox.Get". In some situations, such 'registration' * may not be wanted. * @param name The name of the Lox. Will be converted to upper case. * @param doRegister If \c true, this object is registered with static class * \ref cs::aworx::lox::ALox "ALox". * Optional and defaults to \c true. ******************************************************************************************/ public Lox( String name, bool doRegister = true ) : base() { // set recursion warning of log buffer lock to 1. Warnings are logged if recursively // acquired more than once #if ALOX_DBG_LOG || ALOX_REL_LOG logBufLock.RecursionWarningThreshold= 1; scopeInfo= new ScopeInfo( name, threadDictionary ); scopeDomains= new ScopeStore<AString >( scopeInfo, false ); scopePrefixes= new ScopeStore<Object >( scopeInfo, false ); scopeLogData= new ScopeStore<Dictionary<AString, LogData>>( scopeInfo, true ); scopeLogOnce= new ScopeStore<Dictionary<AString, int[]> >( scopeInfo, true ); // create domain trees domains = new Domain( null, new AString( "") ); internalDomains = new Domain( null, new AString( ALox.InternalDomains, 0, ALox.InternalDomains.Length - 1) ); // create internal sub-domains bool wasCreated= false; String[] internalDomainList= {"LGR", "DMN", "PFX", "THR", "LGD", "VAR" }; foreach ( String it in internalDomainList ) { resDomainInternal._()._NC( it ); internalDomains.Find( resDomainInternal, Case.Sensitive, 1, ref wasCreated ); } maxDomainPathLength= ALox.InternalDomains.Length + 3; // register with ALox if ( doRegister ) ALox.Register( this, ContainerOp.Insert ); // read domain substitution rules from configuration Variable variable= new Variable( ALox.DOMAIN_SUBSTITUTION, GetName() ); if ( variable.Load() != 0 ) { for( int ruleNo= 0; ruleNo< variable.Size(); ruleNo++ ) { AString rule= variable.GetString( ruleNo ); int idx= rule.IndexOf( "->" ); if ( idx > 0 ) { String domainPath= rule.ToString( 0, idx ).Trim(); String replacement= rule.ToString( idx + 2 ).Trim(); SetDomainSubstitutionRule( domainPath, replacement ); } else { // using alib warning here as we can't do internal logging in the constructor ALIB.WARNING( "Syntax error in variable \"" + variable.Fullname + "\"." ); } } } #endif }