public DefaultRequestHandler(IOptions <S3Config> options, IValidatorFactory validator, IMarshalFactory marshaller, IPostMapperFactory postMapper, INetworkDriver networkDriver, HeaderAuthorizationBuilder authBuilder, ILogger <DefaultRequestHandler> logger, IEnumerable <IRequestStreamWrapper>?requestStreamWrappers = null) { Validator.RequireNotNull(options, nameof(options)); Validator.RequireNotNull(validator, nameof(validator)); Validator.RequireNotNull(marshaller, nameof(marshaller)); Validator.RequireNotNull(networkDriver, nameof(networkDriver)); Validator.RequireNotNull(authBuilder, nameof(authBuilder)); Validator.RequireNotNull(logger, nameof(logger)); validator.ValidateAndThrow(options.Value); _validator = validator; _options = options; _networkDriver = networkDriver; _authBuilder = authBuilder; _marshaller = marshaller; _postMapper = postMapper; _logger = logger; if (requestStreamWrappers == null) { _requestStreamWrappers = Array.Empty <IRequestStreamWrapper>(); } else { _requestStreamWrappers = requestStreamWrappers.ToList(); } }
public void SetUp() { _mockedBase64Encoder = new Mock<IBase64Encoder>(); _mockedBase64Encoder .Setup(it => it.Encode(It.IsAny<string>())) .Returns(EncodedAuthorization); _builder = new AuthorizationBuilder(_mockedBase64Encoder.Object); }
public void SetUp() { _mockedBase64Encoder = new Mock <IBase64Encoder>(); _mockedBase64Encoder .Setup(it => it.Encode(It.IsAny <string>())) .Returns(EncodedAuthorization); _builder = new AuthorizationBuilder(_mockedBase64Encoder.Object); }
public static IAuthorizationBuilder AddAuthenticationInterceptors(this IAuthorizationBuilder builder) { var service = builder.Services; service.AddTransient <IdentityAuthorizationInterceptor>(); service.AddTransient <ClientCredentialAuthorizationInterceptor>(); return(builder); }
/// <summary> /// Adds an OpenID Connect token validator for authorization /// <param name="builder">Builder reference</param> /// <param name="wellKnownEndpoint">The well known endpoint</param> /// <param name="audience">(Optional) The audience to verify the token is for</param> /// <param name="tokenValidationParameterFunc">(Optional) If specified then this function will be called to create the parameters used to validate tokens</param> /// <param name="header">(Optional) The header to pull the bearer token from</param> /// </summary> public static IAuthorizationBuilder AddOpenIdConnectTokenValidator(this IAuthorizationBuilder builder, string wellKnownEndpoint, string audience = null, Func <OpenIdConnectConfiguration, string, TokenValidationParameters> tokenValidationParameterFunc = null, string header = null) { // I didn't want to update the builder interface on the point release this is intended for and wanted // to keep the introduction of the package as a none breaking change so it involved a bit of static-ness // to work around the existing interface Implementation.TokenValidator.Configuration = new TokenValidatorConfiguration(wellKnownEndpoint, audience, tokenValidationParameterFunc); builder.TokenValidator <Implementation.TokenValidator>(header); return(builder); }
public DefaultSignedRequestHandler(IOptions <SimpleS3Config> options, IScopeBuilder scopeBuilder, IMarshalFactory marshaller, QueryParameterAuthorizationBuilder authBuilder, IEndpointBuilder endpointBuilder, ILogger <DefaultSignedRequestHandler> logger) { Validator.RequireNotNull(options, nameof(options)); Validator.RequireNotNull(marshaller, nameof(marshaller)); Validator.RequireNotNull(authBuilder, nameof(authBuilder)); Validator.RequireNotNull(logger, nameof(logger)); _config = options.Value; _authBuilder = authBuilder; _endpointBuilder = endpointBuilder; _marshaller = marshaller; _logger = logger; _scopeBuilder = scopeBuilder; }
public static IAuthorizationBuilder AddOpenidClient(this IAuthorizationBuilder builder) { var service = builder.Services; service.TryAddSingleton <IAuthenticationClientFactory, AuthenticationClientFactory>(); var authorizationTypes = Enum.GetNames(typeof(AuthorizationType)); foreach (var type in authorizationTypes) { AddAuthenticationClient(service, type); } return(builder); }
public DefaultSignedRequestHandler(IOptions <S3Config> options, IScopeBuilder scopeBuilder, IValidatorFactory validator, IMarshalFactory marshaller, QueryParameterAuthorizationBuilder authBuilder, ILogger <DefaultSignedRequestHandler> logger) { Validator.RequireNotNull(options, nameof(options)); Validator.RequireNotNull(validator, nameof(validator)); Validator.RequireNotNull(marshaller, nameof(marshaller)); Validator.RequireNotNull(authBuilder, nameof(authBuilder)); Validator.RequireNotNull(logger, nameof(logger)); validator.ValidateAndThrow(options.Value); _validator = validator; _options = options; _authBuilder = authBuilder; _marshaller = marshaller; _logger = logger; _scopeBuilder = scopeBuilder; }
public DefaultRequestHandler(IOptions <S3Config> options, IValidatorFactory validator, IMarshalFactory marshaller, INetworkDriver networkDriver, IAuthorizationBuilder authBuilder, IEnumerable <IRequestStreamWrapper> requestStreamWrappers, ILogger <DefaultRequestHandler> logger) { Validator.RequireNotNull(options); Validator.RequireNotNull(validator); Validator.RequireNotNull(marshaller); Validator.RequireNotNull(networkDriver); Validator.RequireNotNull(authBuilder); Validator.RequireNotNull(requestStreamWrappers); Validator.RequireNotNull(logger); validator.ValidateAndThrow(options.Value); _validator = validator; _options = options; _networkDriver = networkDriver; _authBuilder = authBuilder; _marshaller = marshaller; _requestStreamWrappers = requestStreamWrappers.ToList(); _logger = logger; }
public AllHttpHeadersBuilder(IHttpHeaderBuilder httpHeaderBuilder, IAuthorizationBuilder authorizationBuilder) { _httpHeaderBuilder = httpHeaderBuilder; _authorizationBuilder = authorizationBuilder; }
public static IAuthorizationBuilder SetupDatabase <TAuthContext, TUser, TRole>(this IAuthorizationBuilder authorizationBuilder) where TAuthContext : AuthorizationContextBase <TUser, TRole> where TUser : User, new() where TRole : Role, new() { var authorizationContext = authorizationBuilder.ServiceProvider.GetRequiredService <TAuthContext>(); authorizationContext.Database.Migrate(); return(authorizationBuilder); }
public static IAuthorizationBuilder SetupDatabase(this IAuthorizationBuilder authorizationBuilder) { return(authorizationBuilder.SetupDatabase <AuthorizationContext, User, Role>()); }