public UrlGenerator(IOptions <UrlsOptions> urlsOptions, IAssetStore assetStore, bool allowAssetSourceUrl) { this.assetStore = assetStore; this.urlsOptions = urlsOptions.Value; CanGenerateAssetSourceUrl = allowAssetSourceUrl; }
public static SwaggerDocument CreateApiDocument(HttpContext context, UrlsOptions urlOptions, string appName) { var scheme = string.Equals(context.Request.Scheme, "http", StringComparison.OrdinalIgnoreCase) ? SwaggerSchema.Http : SwaggerSchema.Https; var document = new SwaggerDocument { Schemes = new List <SwaggerSchema> { scheme }, Consumes = new List <string> { "application/json" }, Produces = new List <string> { "application/json" }, Info = new SwaggerInfo { Title = $"Squidex API for {appName} App" }, BasePath = Constants.ApiPrefix }; if (!string.IsNullOrWhiteSpace(context.Request.Host.Value)) { document.Host = context.Request.Host.Value; } return(document); }
public FacultyService( IUnitOfWork unitOfWork, IOptions <UrlsOptions> urlOptions, IMapper mapper) { _mapper = mapper; _unitOfWork = unitOfWork; _urlOptions = urlOptions.Value; }
public ShowsService(IShowsRepository showsRepository, IHttpClientFactory httpClientFactory, IOptions <ClientNamesOptions> applicationOptions, IOptions <UrlsOptions> urlsOptions) { _showsRepository = showsRepository; _httpClientFactory = httpClientFactory; _clientNamesOptions = applicationOptions.Value; _urlsOptions = urlsOptions.Value; }
public TeacherService( IUnitOfWork unitOfWork, IOptions <UrlsOptions> urlOptions, IMapper mapper, IDateHelper dateHelper) { _mapper = mapper; _unitOfWork = unitOfWork; _urlOptions = urlOptions.Value; _dateHelper = dateHelper; }
public UrlGenerator(IOptions <UrlsOptions> urlsOptions, IAssetFileStore assetFileStore, bool allowAssetSourceUrl) { Guard.NotNull(assetFileStore); Guard.NotNull(urlsOptions); this.assetFileStore = assetFileStore; this.urlsOptions = urlsOptions.Value; CanGenerateAssetSourceUrl = allowAssetSourceUrl; }
public SchemasOpenApiGenerator(IOptions <UrlsOptions> urlOptions, IEnumerable <IDocumentProcessor> documentProcessors) { this.urlOptions = urlOptions.Value; settings.ConfigureSchemaSettings(); foreach (var processor in documentProcessors) { settings.DocumentProcessors.Add(processor); } }
public AuthorizationController( IServiceResultMapper viewMapper, IAuthorizationService authorizationService, IOptions <UrlsOptions> urlsOptions, ILogger <AuthorizationController> logger) { _logger = logger; _viewMapper = viewMapper; _authorizationService = authorizationService; _urlsOption = urlsOptions.Value; }
public FileService(IOptions <FilesOptions> fileOptions, IOptions <UrlsOptions> urlOptions, IHostingEnvironment hostingEnvironment, IMapper mapper, ILogger <FileService> logger) { _fileOptions = fileOptions.Value; _urlOptions = urlOptions.Value; _hostingEnvironment = hostingEnvironment; _mapper = mapper; _logger = logger; }
public CheckOutController(IOptionsSnapshot <PayeeInfoConfig> payeeInfoOptionsAccessor, IOptionsSnapshot <UrlsOptions> urlsAccessor, Cart cart, StoreDbContext storeDbContext, ISwedbankPayClient payClient) { this.payeeInfoOptions = payeeInfoOptionsAccessor.Value; this.urls = urlsAccessor.Value; this.cartService = cart; this.context = storeDbContext; this.swedbankPayClient = payClient; }
private static OpenApiSecurityScheme CreateOAuthSchema(UrlsOptions urlOptions) { var security = new OpenApiSecurityScheme { Type = OpenApiSecuritySchemeType.OAuth2 }; var tokenUrl = urlOptions.BuildUrl($"{Constants.IdentityServerPrefix}/connect/token", false); security.TokenUrl = tokenUrl; SetupDescription(security, tokenUrl); SetupFlow(security); SetupScopes(security); return(security); }
public AuthorizationService( IUnitOfWork repositoryWrapper, IMapper mapper, IEmailService emailService, IRefreshTokenService refreshTokenService, IOptions <UrlsOptions> urlOptions, ILogger <AuthorizationService> logger, IDateHelper dateHelper, IEncryptHelper encryptHelper) { _encryptHelper = encryptHelper; _dateHelper = dateHelper; _emailService = emailService; _mapper = mapper; _unitOfWork = repositoryWrapper; _refreshTokenService = refreshTokenService; _urlOptions = urlOptions.Value; _logger = logger; }
public UsagesController( ICommandBus commandBus, IApiUsageTracker usageTracker, IAppLogStore appLogStore, IAppPlansProvider appPlansProvider, IAssetUsageTracker assetStatsRepository, IDataProtectionProvider dataProtection, IOptions <UrlsOptions> urlsOptions) : base(commandBus) { this.usageTracker = usageTracker; this.appLogStore = appLogStore; this.appPlansProvider = appPlansProvider; this.assetStatsRepository = assetStatsRepository; this.urlsOptions = urlsOptions.Value; dataProtector = dataProtection.CreateProtector("LogToken"); }
public AccountController( SignInManager <IdentityUser> signInManager, UserManager <IdentityUser> userManager, IUserFactory userFactory, IUserEvents userEvents, IOptions <UrlsOptions> urlsOptions, IOptions <MyIdentityOptions> identityOptions, ISemanticLog log, IIdentityServerInteractionService interactions) { this.identityOptions = identityOptions.Value; this.interactions = interactions; this.signInManager = signInManager; this.urlsOptions = urlsOptions.Value; this.userEvents = userEvents; this.userFactory = userFactory; this.userManager = userManager; this.log = log; }
private static OpenApiSecurityScheme CreateOAuthSchema(UrlsOptions urlOptions) { var security = new OpenApiSecurityScheme { Type = OpenApiSecuritySchemeType.OAuth2 }; var tokenUrl = urlOptions.BuildUrl($"{Constants.IdentityServerPrefix}/connect/token", false); security.TokenUrl = tokenUrl; SetupDescription(security, tokenUrl); security.Flow = OpenApiOAuth2Flow.Application; security.Scopes = new Dictionary <string, string> { [Constants.ApiScope] = "Read and write access to the API" }; return(security); }
private static SwaggerSecurityScheme CreateOAuthSchema(UrlsOptions urlOptions) { var securityScheme = new SwaggerSecurityScheme(); var tokenUrl = urlOptions.BuildUrl($"{Constants.IdentityServerPrefix}/connect/token", false); securityScheme.TokenUrl = tokenUrl; var securityDocs = NSwagHelper.LoadDocs("security"); var securityText = securityDocs.Replace("<TOKEN_URL>", tokenUrl); securityScheme.Description = securityText; securityScheme.Type = SwaggerSecuritySchemeType.OAuth2; securityScheme.Flow = SwaggerOAuth2Flow.Application; securityScheme.Scopes = new Dictionary <string, string> { [Constants.ApiScope] = "Read and write access to the API" }; return(securityScheme); }
public EnforceHttpsMiddleware(IOptions <UrlsOptions> urls) { this.urls = urls.Value; }
private static IEnumerable <Client> CreateStaticClients(UrlsOptions urlsOptions, MyIdentityOptions identityOptions) { var frontendId = Constants.FrontendClient; yield return(new Client { ClientId = frontendId, ClientName = frontendId, RedirectUris = new List <string> { urlsOptions.BuildUrl("login;"), urlsOptions.BuildUrl("client-callback-silent", false), urlsOptions.BuildUrl("client-callback-popup", false) }, PostLogoutRedirectUris = new List <string> { urlsOptions.BuildUrl("logout", false) }, AllowAccessTokensViaBrowser = true, AllowedGrantTypes = GrantTypes.Implicit, AllowedScopes = new List <string> { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile, IdentityServerConstants.StandardScopes.Email, Constants.ApiScope, Constants.PermissionsScope, Constants.ProfileScope, Constants.RoleScope }, RequireConsent = false }); var internalClient = Constants.InternalClientId; yield return(new Client { ClientId = internalClient, ClientName = internalClient, ClientSecrets = new List <Secret> { new Secret(Constants.InternalClientSecret) }, RedirectUris = new List <string> { urlsOptions.BuildUrl($"{Constants.PortalPrefix}/signin-internal", false), urlsOptions.BuildUrl($"{Constants.OrleansPrefix}/signin-internal", false) }, AccessTokenLifetime = (int)TimeSpan.FromDays(30).TotalSeconds, AllowedGrantTypes = GrantTypes.ImplicitAndClientCredentials, AllowedScopes = new List <string> { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile, IdentityServerConstants.StandardScopes.Email, Constants.ApiScope, Constants.PermissionsScope, Constants.ProfileScope, Constants.RoleScope }, RequireConsent = false }); if (identityOptions.IsAdminClientConfigured()) { var id = identityOptions.AdminClientId; yield return(new Client { ClientId = id, ClientName = id, ClientSecrets = new List <Secret> { new Secret(identityOptions.AdminClientSecret.Sha256()) }, AccessTokenLifetime = (int)TimeSpan.FromDays(30).TotalSeconds, AllowedGrantTypes = GrantTypes.ClientCredentials, AllowedScopes = new List <string> { Constants.ApiScope, Constants.RoleScope, Constants.PermissionsScope }, Claims = new List <Claim> { new Claim(SquidexClaimTypes.Permissions, Permissions.All) } }); } }
public EnforceHttpsMiddleware(IOptions <UrlsOptions> urlsOptions) { Guard.NotNull(urlsOptions, nameof(urlsOptions)); this.urlsOptions = urlsOptions.Value; }