public SettingsProvider(SquidexClientManager clientManager, IMemoryCache cache, IOptions <SettingsData> defaults) : base(cache) { apiClient = clientManager.GetClient <SettingsEntity, SettingsData>("settings"); this.defaults = defaults; }
public ClientManagerFixture() { ClientManager = new SquidexClientManager(ServerUrl, AppName, ClientId, ClientSecret) { ReadResponseAsString = true }; }
public ProductService() { _clientManager = new SquidexClientManager("https://cloud.squidex.io", "testing1337", "testing1337:default", "oy481dmvis5gdrxnijbpjtkh2eevle0g2i63xvt93gcx"); }
public async Task <Item> GetItem() { var manager = SquidexClientManager.FromOption(_configuration.ToSquidexOptions()); var clientInformation = manager.GetClient <Item, _Item>("information"); var resultInformation = await clientInformation.GetAsync(context : SquidexParser.DefaultContext("tr")); return(resultInformation.Items.FirstOrDefault()); }
public ResourceStore(IMemoryCache cache, SquidexClientManager clientManager, IStringLocalizer <AppResources> localizer) : base(cache) { apiApiResources = clientManager.GetClient <ResourceEntity, ResourceData>("api-resources"); apiIdentityResources = clientManager.GetClient <ResourceEntity, ResourceData>("identity-resources"); this.localizer = localizer; }
public async Task <List <Item> > GetItems() { var manager = SquidexClientManager.FromOption(_configuration.ToSquidexOptions()); var clientExperience = manager.GetClient <Item, _Item>("experience"); var resultExperience = await clientExperience.GetAsync(context : SquidexParser.DefaultContext("tr")); return(resultExperience.Items.OrderBy(x => x.Data.OrderNo).ToList()); }
public SquidexClientManagerFactory( IOptions <SquidexOptions> appDefault, IOptions <SquidexOptionsPerHost> appPerHost, IHttpContextAccessor httpContextAccessor) { this.appDefault = new SquidexClientManager(appDefault.Value); this.appPerHost = appPerHost.Value; this.httpContextAccessor = httpContextAccessor; }
public BasicClientTests() { sut = new SquidexClientManager(new SquidexOptions { AppName = "squidex-website", ClientId = "squidex-website:reader", ClientSecret = "yy9x4dcxsnp1s34r2z19t88wedbzxn1tfq7uzmoxf60x" }); }
public void ConfigureServices(IServiceCollection services) { services.Configure <SquidexOptions>(Configuration.GetSection("app")); services.AddSingleton(c => SquidexClientManager.FromOption(c.GetRequiredService <IOptions <SquidexOptions> >().Value)); services.AddMvc(); }
public ApiClient(IOptions <SquidexOptions> appOptions) { var options = appOptions.Value; var clientManager = new SquidexClientManager(options); pagesClient = clientManager.CreateContentsClient <Page, PageData>("pages"); postsClient = clientManager.CreateContentsClient <BlogPost, BlogPostData>("posts"); }
public ClientManagerFixture() { ClientManager = new SquidexClientManager(new SquidexOptions { AppName = AppName, ClientId = ClientId, ClientSecret = ClientSecret, ReadResponseAsString = true, Url = ServerUrl }); }
public async Task Should_invoke_restore() { var clientManager = new SquidexClientManager("http://localhost:5000", "noapp", "test", "oy6kRrOl00PWsLuVuhCALjsTV9yTv18LlTEbVvTHnyM="); var client = clientManager.CreateBackupsClient(); await client.PostRestoreJobAsync(new RestoreRequestDto { Url = new Uri("http://localhost:5000/api/apps/aa/backups/547eb007-e702-43a0-a71a-a24faa4efa79"), Name = "app2" }); }
public ApiClient(AppOptions options) { var clientManager = new SquidexClientManager( options.Url, options.AppName, options.ClientId, options.ClientSecret); pagesClient = clientManager.GetClient <Page, PageData>("pages"); postsClient = clientManager.GetClient <BlogPost, BlogPostData>("posts"); }
public FeaturesService(IOptions <MyNewsOptions> options) { if (options.Value.IsConfigured()) { var clientManager = new SquidexClientManager("https://cloud.squidex.io", options.Value.AppName, options.Value.ClientId, options.Value.ClientSecret); client = clientManager.GetClient <NewsEntity, FeatureDto>("feature-news"); } }
public void ConnectToCMS(AppOptions appOptions) { var options = new SquidexOptions() { AppName = appOptions.AppName, ClientId = appOptions.ClientId, ClientSecret = appOptions.ClientSecret, Url = appOptions.Url }; clientManager = new SquidexClientManager(options); ledColorsSeqClient = clientManager.CreateContentsClient <LedColorsSeq, LedColorsSeqData>("cp-led-color-sequence"); collectionPointsData = clientManager.CreateContentsClient <CollectionPoint, CollectionPointData>("collection-points"); cpImageAsset = clientManager.CreateContentsClient <ImageAsset, ImageAssetData>("cp-image-asset"); cpQuoteAsset = clientManager.CreateContentsClient <QuoteAsset, QuoteAssetData>("cp-qoute-asset"); }
public FeaturesService(IOptions <MyNewsOptions> options) { if (options.Value.IsConfigured()) { var squidexOptions = new SquidexOptions { AppName = options.Value.AppName, ClientId = options.Value.ClientId, ClientSecret = options.Value.ClientSecret, Url = "https://cloud.squidex.io" }; var clientManager = new SquidexClientManager(squidexOptions); client = clientManager.CreateContentsClient <NewsEntity, FeatureDto>("feature-news"); } }
public ApiClient(IOptions <AppOptions> appOptions) { var options = appOptions.Value; var clientManager = new SquidexClientManager( options.Url, options.AppName, options.ClientId, options.ClientSecret); pagesClient = clientManager.CreateContentsClient <Page, PageData>("pages"); postsClient = clientManager.CreateContentsClient <BlogPost, BlogPostData>("posts"); //pagesClient = clientManager.GetClient<Page, PageData>("pages"); //postsClient = clientManager.GetClient<BlogPost, BlogPostData>("posts"); }
public ApiClient(IOptions <AppOptions> appOptions) { var options = appOptions.Value; var clientManager = new SquidexClientManager( options.Url, options.AppName, options.ClientId, options.ClientSecret); pagesClient = clientManager.GetClient <Page, PageData>("pages"); heroesClient = clientManager.GetClient <Hero, HeroData>("heroes"); articlesClient = clientManager.GetClient <Article, ArticleData>("articles"); authorsClient = clientManager.GetClient <Author, AuthorData>("authors"); categoriesClient = clientManager.GetClient <Category, CategoryData>("categories"); }
public SquidexRepo(IOptions <SquidexConfig> appOptions) { var options = appOptions.Value; var clientManager = new SquidexClientManager( options.Url, options.AppName, options.ClientId, options.ClientSecret); _blogCategoriesClient = clientManager.GetClient <BlogCategoryEntity, BlogCategoryData>("blog-categories"); _blogPostClient = clientManager.GetClient <BlogPostEntity, BlogPostData>("blog-posts"); _blogPostTagClient = clientManager.GetClient <BlogPostTagEntity, BlogPostTagData>("blog-post-tags"); _globalClient = clientManager.GetClient <GlobalConfigEntity, GlobalConfigData>("global"); _profileClient = clientManager.GetClient <ProfileEntity, ProfileData>("profile"); }
public ClientManagerWrapper() { var appName = GetValue("APP__NAME", "integration-tests"); var clientId = GetValue("CLIENT__ID", "root"); var clientSecret = GetValue("CLIENT__SECRET", "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0="); var serviceURl = GetValue("SERVER__URL", "https://localhost:5001"); ClientManager = new SquidexClientManager(new SquidexOptions { AppName = appName, ClientId = clientId, ClientSecret = clientSecret, ReadResponseAsString = true, Configurator = AcceptAllCertificatesConfigurator.Instance, Url = serviceURl }); }
public ClientManagerWrapper() { var appName = GetValue("config:app:name", "integration-tests"); var clientId = GetValue("config:client:id", "root"); var clientSecret = GetValue("config:client:secret", "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0="); var serverUrl = GetValue("config:server:url", "https://localhost:5001"); ClientManager = new SquidexClientManager(new SquidexOptions { AppName = appName, ClientId = clientId, ClientSecret = clientSecret, ClientFactory = null, Configurator = AcceptAllCertificatesConfigurator.Instance, ReadResponseAsString = true, Url = serverUrl }); }
public SquidexRepo(IOptions <SquidexConfig> appOptions, ICacheProvider cache) { var options = appOptions.Value; var clientManager = new SquidexClientManager( options.Url, options.AppName, options.ClientId, options.ClientSecret); _portfolioProjectsClient = clientManager.GetClient <PortfolioProjectEntity, PortfolioProjectData>("portfolio-projects"); _blogPostClient = clientManager.GetClient <BlogPostEntity, BlogPostData>("blog-posts"); _skillTypesClient = clientManager.GetClient <SkillTypeEntity, SkillTypeData>("skill-types"); _globalClient = clientManager.GetClient <GlobalEntity, GlobalData>("global"); _portfolioClient = clientManager.GetClient <PortfolioEntity, PortfolioData>("portfolio"); _cache = cache; }
public CloudFixture() { ClientManager = new SquidexClientManager( new SquidexOptions { AppName = "squidex-website", ClientId = "squidex-website:reader", ClientSecret = "yy9x4dcxsnp1s34r2z19t88wedbzxn1tfq7uzmoxf60x" }); CDNClientManager = new SquidexClientManager( new SquidexOptions { AppName = "squidex-website", AssetCDN = "https://assets.squidex.io", ClientId = "squidex-website:reader", ClientSecret = "yy9x4dcxsnp1s34r2z19t88wedbzxn1tfq7uzmoxf60x", ContentCDN = "https://contents.squidex.io", }); }
public SquidexRepo(IOptions <SquidexConfig> appOptions) { var options = appOptions.Value; var clientManager = new SquidexClientManager( options.Url, options.AppName, options.ClientId, options.ClientSecret); _portfolioProjectsClient = clientManager.GetClient <ProjectEntity, ProjectData>(CacheConstants.SquidexSchemas.Projects); _blogPostClient = clientManager.GetClient <BlogPostEntity, BlogPostData>(CacheConstants.SquidexSchemas.BlogPosts); _globalClient = clientManager.GetClient <GlobalEntity, GlobalData>(CacheConstants.SquidexSchemas.Global); _authorsClient = clientManager.GetClient <AuthorEntity, AuthorData>(CacheConstants.SquidexSchemas.Authors); _pageAboutClient = clientManager.GetClient <PageAboutEntity, PageAboutData>(CacheConstants.SquidexSchemas.Pages.About); _pageContactClient = clientManager.GetClient <PageContactEntity, PageContactData>(CacheConstants.SquidexSchemas.Pages.Contact); _pageIndexClient = clientManager.GetClient <PageIndexEntity, PageIndexData>(CacheConstants.SquidexSchemas.Pages.Index); _pageProjectsClient = clientManager.GetClient <PageProjectsEntity, PageProjectsData>(CacheConstants.SquidexSchemas.Pages.Projects); }
private async Task ImportAsync(IImortArgumentBase arguments, SquidexClientManager service, IEnumerable <DummyData> datas) { var client = service.CreateContentsClient <DummyEntity, DummyData>(arguments.Schema); var totalWritten = 0; var consoleTop = Console.CursorTop; var handled = new HashSet <string>(); foreach (var data in datas) { await client.CreateAsync(data, !arguments.Unpublished); totalWritten++; Console.WriteLine("> Imported: {0}.", totalWritten); Console.SetCursorPosition(0, consoleTop); } Console.WriteLine("> Imported: {0}. Completed.", totalWritten); }
public void ConfigureServices(IServiceCollection services) { services.Configure <SquidexOptions>(Configuration.GetSection("app")); services.Configure <SettingsData>(Configuration.GetSection("defaultSettings")); services.AddSingleton(c => SquidexClientManager.FromOption(c.GetRequiredService <IOptions <SquidexOptions> >().Value)); services.AddMemoryCache(); services.AddLocalization(options => { options.ResourcesPath = "Resources"; }); services.AddRouting(options => { options.LowercaseUrls = true; }); services.AddSingleton <IConfigureOptions <KeyManagementOptions> >(s => { return(new ConfigureOptions <KeyManagementOptions>(options => { options.XmlRepository = s.GetRequiredService <IXmlRepository>(); })); }); services.AddDataProtection().SetApplicationName("SquidexIdentity"); services.AddAuthentication() .AddCookie() .AddFacebook() .AddGoogle() .AddMicrosoftAccount() .AddTwitter(); services.ConfigureApplicationCookie(options => { options.LoginPath = "/login"; options.LogoutPath = "/logout"; options.AccessDeniedPath = "/accessdenied"; }); services.AddIdentity <UserEntity, RoleEntity>() .AddUserStore <UserStore>() .AddRoleStore <RoleStore>() .AddDefaultTokenProviders(); services.AddIdentityServer(options => { options.Events.RaiseSuccessEvents = true; options.Events.RaiseFailureEvents = true; options.Events.RaiseErrorEvents = true; options.Events.RaiseInformationEvents = true; options.UserInteraction.LoginUrl = "/login"; options.UserInteraction.LogoutUrl = "/logout"; options.UserInteraction.ErrorUrl = "/error"; options.UserInteraction.ConsentUrl = "/consent"; }) .AddAppAuthRedirectUriValidator() .AddAspNetIdentity <UserEntity>() .AddClientConfigurationValidator <DefaultClientConfigurationValidator>() .AddClientStore <ClientStore>() .AddDeveloperSigningCredential() .AddInMemoryCaching() .AddResourceStore <ResourceStore>(); services.AddMvc() .AddViewLocalization(options => { options.ResourcesPath = "Resources"; }) .AddDataAnnotationsLocalization(options => { options.DataAnnotationLocalizerProvider = (type, factory) => factory.Create(typeof(AppResources)); }) .AddRazorPagesOptions(options => { options.Conventions.AuthorizeFolder("/Manage"); options.Conventions.AuthorizePage("/Logout"); }); services.AddSingleton <HaveIBeenPwnedRestClient>(); services.AddAuthenticationConfigurator <FacebookOptions, FacebookHandler>( AuthenticationSchemeType.Facebook, Factories.OAuth <FacebookOptions>); services.AddAuthenticationConfigurator <GoogleOptions, GoogleHandler>( AuthenticationSchemeType.Google, Factories.OAuth <GoogleOptions>); services.AddAuthenticationConfigurator <MicrosoftAccountOptions, MicrosoftAccountHandler>( AuthenticationSchemeType.Microsoft, Factories.OAuth <MicrosoftAccountOptions>); services.AddAuthenticationConfigurator <TwitterOptions, TwitterHandler>( AuthenticationSchemeType.Twitter, Factories.Twitter); services.AddSingleton <IPasswordValidator <UserEntity>, PwnedPasswordValidator>(); services.AddSingleton <IEmailValidator, PwnedEmailValidator>(); services.AddSingleton <IAuthenticationSchemeProvider, SquidexAuthenticationSchemeProvider>(); services.AddSingleton <IAuthenticationSchemeStore, AuthenticationSchemeStore>(); services.AddSingleton <ISettingsProvider, SettingsProvider>(); services.AddSingleton <IEmailSender, EmailSender>(); var storeType = Configuration.GetValue <string>("store:type"); if (string.Equals(storeType, "MongoDB", StringComparison.OrdinalIgnoreCase)) { services.AddMongoDB(Configuration); } else { throw new ApplicationException("You have to define the store with 'store:type'. Allowed values: MongoDB"); } }
public Session(string app, SquidexClientManager clientManager) { App = app; this.clientManager = clientManager; }
public ClientStore(SquidexClientManager clientManager) { apiClient = clientManager.GetClient <ClientEntity, ClientData>("clients"); apiClientManager = clientManager; }
public HeaderViewComponent(SquidexClientManager clientManager, AssetService assetService) { this._clientManager = clientManager; this._assetService = assetService; }
public SquidexService(IOptions <SquidexOptions> squidexOptions) { _squidexClientManager = new SquidexClientManager(squidexOptions.Value); _squidexOptions = squidexOptions.Value; }