/// <summary> /// The variables provider can be exchanged as long as the variables are not yet initialized /// </summary> public virtual void SetVariablesProvider(IVariablesProvider variablesProvider) { if (variables != null) { // already initialized } VariablesProvider = variablesProvider; }
internal BewitTokenValidatorAccessor( ICryptographyService cryptographyService, IVariablesProvider variablesProvider, INonceRepository nonceRepository) : base(new BewitPayloadContext(typeof(T)) .SetCryptographyService(() => cryptographyService) .SetVariablesProvider(() => variablesProvider) .SetRepository(() => nonceRepository)) { }
public BewitTokenGeneratorAccessor( TimeSpan tokenDuration, ICryptographyService cryptographyService, IVariablesProvider variablesProvider) : base(new BewitOptions { TokenDuration = tokenDuration }, new BewitPayloadContext(typeof(T)) .SetCryptographyService(() => cryptographyService) .SetVariablesProvider(() => variablesProvider) .SetRepository(() => new DefaultNonceRepository())) { }
public BewitTokenValidator(BewitPayloadContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _cryptographyService = context.CreateCryptographyService?.Invoke() ?? throw new ArgumentNullException(nameof(BewitPayloadContext.CreateCryptographyService)); _variablesProvider = context.CreateVariablesProvider?.Invoke() ?? throw new ArgumentNullException(nameof(BewitPayloadContext.CreateVariablesProvider)); _repository = context.CreateRepository?.Invoke() ?? throw new ArgumentNullException(nameof(BewitPayloadContext.CreateRepository)); }
internal static TestServer CreateServer <T>(BewitOptions options) { NonceRepository = new DefaultNonceRepository(); VariablesProvider = new MockedVariablesProvider(); IWebHostBuilder hostBuilder = new WebHostBuilder() .ConfigureServices(services => { services.AddMvc(); services .AddTransient <BewitAttribute>() .AddSingleton(options) .AddBewitValidation(options, b => b.AddPayload <T>() .SetVariablesProvider(() => VariablesProvider)); }) .Configure(app => app.UseRouting().UseEndpoints(c => c.MapControllers())); var server = new TestServer(hostBuilder); return(server); }
public BewitTokenGenerator( BewitOptions options, BewitPayloadContext context) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } _tokenDuration = options.TokenDuration; _cryptographyService = context.CreateCryptographyService?.Invoke() ?? throw new ArgumentNullException(nameof(BewitPayloadContext.CreateCryptographyService)); _variablesProvider = context.CreateVariablesProvider?.Invoke() ?? throw new ArgumentNullException(nameof(BewitPayloadContext.CreateVariablesProvider)); _repository = context.CreateRepository?.Invoke() ?? throw new ArgumentNullException(nameof(BewitPayloadContext.CreateRepository)); }
public WorkspaceVariableCompletionProvider(IVariablesProvider provider, IImageService imageService) { _variablesProvider = provider; _functionGlyph = imageService.GetImage(ImageType.Method); _variableGlyph = imageService.GetImage(ImageType.Variable); }
public WorkspaceVariableCompletionProvider(IVariablesProvider provider, IGlyphService glyphService) { _variablesProvider = provider; _glyphService = glyphService; }
public VariableStore(IVariablesProvider provider, params IVariableStoreObserver[] observers) { VariablesProvider = provider; Observers = new List <IVariableStoreObserver>(); Observers.AddRange(observers); }
public WorkspaceVariableCompletionProvider(ICoreShell shell, IVariablesProvider provider) { _shell = shell; _variablesProvider = provider; }