public BreadCrumbMiddleware(OwinMiddleware next, string crumb, string expectedStage)
     : base(next)
 {
     _crumb = crumb;
     _expectedStage = expectedStage;
 }
 public ExceptionTrackingMiddleware(OwinMiddleware next)
     : this(next, null)
 {
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HealthMiddleware"/> class.
 /// </summary>
 /// <param name="next">OwinMiddleware Param</param>
 public HealthMiddleware(OwinMiddleware next)
     : base(next)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InvalidAuthenticationMiddleware"/> class.
 /// </summary>
 /// <param name="next">
 /// The next.
 /// </param>
 public InvalidAuthenticationMiddleware(OwinMiddleware next)
     : base(next)
 {
 }
Esempio n. 5
0
 public NLogMiddleware(OwinMiddleware next)
     : base(next)
 {
 }
Esempio n. 6
0
 public CustomMiddleware(OwinMiddleware next) : base(next)
 {
 }
 public MappingsEndpointOwinMiddleware(OwinMiddleware next, IMappingsOptions options, IEnumerable <IManagementOptions> mgmtOptions, IApiExplorer apiExplorer, ILogger logger = null)
     : base(next, mgmtOptions, logger: logger)
 {
     _options     = options;
     _apiExplorer = apiExplorer;
 }
Esempio n. 8
0
 public HealthEndpointOwinMiddleware(OwinMiddleware next, HealthEndpoint endpoint, ILogger <HealthEndpointOwinMiddleware> logger = null)
     : base(next, endpoint, logger: logger)
 {
     _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
 }
Esempio n. 9
0
 /// <summary>
 /// Instantiates the middleware with an optional pointer to the next component.
 /// </summary>
 /// <param name="next"></param>
 public ApiMiddleware(OwinMiddleware next) : base(next)
 {
 }
Esempio n. 10
0
 public LoggingMiddleware(OwinMiddleware next) :
     base(next)
 {
 }
Esempio n. 11
0
 public HealthEndpointOwinMiddleware(OwinMiddleware next, HealthEndpoint endpoint, IEnumerable <IManagementOptions> mgmtOptions, ILogger <HealthEndpointOwinMiddleware> logger = null)
     : base(next, endpoint, mgmtOptions, logger: logger)
 {
     _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
 }
Esempio n. 12
0
 public Middleware2(OwinMiddleware next) : base(next)
 {
 }
Esempio n. 13
0
 public InterceptMiddleware(OwinMiddleware next) : base(next)
 {
 }
Esempio n. 14
0
 public void Init()
 {
     _fixture        = new Fixture().Customize(new AutoRhinoMockCustomization());
     _nextMiddleware = MockRepository.GenerateMock <OwinMiddleware>(new FakeRootMiddelware());
     _sut            = new OnlyHttpGetMiddleware(_nextMiddleware);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="next"></param>
 public OwinMiddlewareTransition(OwinMiddleware next)
 {
     _next = next;
 }
 public AbstractPluginPathMiddleware(OwinMiddleware next) : base(next)
 {
 }
        /// <summary>
        /// Creates a new instance of the <see cref="OpenIdConnectServerMiddleware"/> class.
        /// </summary>
        public OpenIdConnectServerMiddleware(
            [NotNull] OwinMiddleware next,
            [NotNull] IDictionary <string, object> properties,
            [NotNull] OpenIdConnectServerOptions options)
            : base(next, options)
        {
            if (Options.Provider == null)
            {
                throw new ArgumentException("The authorization provider registered in the options cannot be null.", nameof(options));
            }

            if (Options.HtmlEncoder == null)
            {
                throw new ArgumentException("The HTML encoder registered in the options cannot be null.", nameof(options));
            }

            if (Options.SystemClock == null)
            {
                throw new ArgumentException("The system clock registered in the options cannot be null.", nameof(options));
            }

            if (Options.Issuer != null)
            {
                if (!Options.Issuer.IsAbsoluteUri)
                {
                    throw new ArgumentException("The issuer registered in the options must be a valid absolute URI.", nameof(options));
                }

                // See http://openid.net/specs/openid-connect-discovery-1_0.html#IssuerDiscovery
                if (!string.IsNullOrEmpty(Options.Issuer.Query) || !string.IsNullOrEmpty(Options.Issuer.Fragment))
                {
                    throw new ArgumentException("The issuer registered in the options must contain " +
                                                "no query and no fragment parts.", nameof(options));
                }

                // Note: while the issuer parameter should be a HTTPS URI, making HTTPS mandatory
                // in Owin.Security.OpenIdConnect.Server would prevent the end developer from
                // running the different samples in test environments, where HTTPS is often disabled.
                // To mitigate this issue, AllowInsecureHttp can be set to true to bypass the HTTPS check.
                // See http://openid.net/specs/openid-connect-discovery-1_0.html#IssuerDiscovery
                if (!Options.AllowInsecureHttp && string.Equals(Options.Issuer.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase))
                {
                    throw new ArgumentException("The issuer registered in the options must be a HTTPS URI when " +
                                                "AllowInsecureHttp is not set to true.", nameof(options));
                }
            }

            if (Options.AuthenticationMode == AuthenticationMode.Active)
            {
                throw new ArgumentException("Automatic authentication cannot be used with " +
                                            "the OpenID Connect server middleware.", nameof(options));
            }

            // Ensure at least one signing certificate/key was registered if an access token handler was registered.
            if (Options.AccessTokenHandler != null && Options.SigningCredentials.Count == 0)
            {
                throw new ArgumentException(
                          "At least one signing key must be registered when using JWT as the access token format. " +
                          "Consider registering a X.509 certificate using 'options.SigningCredentials.AddCertificate()' " +
                          "or call 'options.SigningCredentials.AddEphemeralKey()' to use an ephemeral key.", nameof(options));
            }

            if (Options.Logger == null)
            {
                options.Logger = NullLogger.Instance;
            }

            if (Options.DataProtectionProvider == null)
            {
                // Use the application name provided by the OWIN host as the Data Protection discriminator.
                // If the application name cannot be resolved, throw an invalid operation exception.
                var discriminator = new AppProperties(properties).AppName;
                if (string.IsNullOrEmpty(discriminator))
                {
                    throw new InvalidOperationException(
                              "The application name cannot be resolved from the OWIN application builder. " +
                              "Consider manually setting the 'DataProtectionProvider' property in the " +
                              "options using 'DataProtectionProvider.Create([unique application name])'.");
                }

                Options.DataProtectionProvider = DataProtectionProvider.Create(discriminator);
            }

            if (Options.AccessTokenFormat == null)
            {
                var protector = Options.DataProtectionProvider.CreateProtector(
                    nameof(OpenIdConnectServerHandler),
                    nameof(Options.AccessTokenFormat), Options.AuthenticationType);

                Options.AccessTokenFormat = new AspNetTicketDataFormat(new DataProtectorShim(protector));
            }

            if (Options.AuthorizationCodeFormat == null)
            {
                var protector = Options.DataProtectionProvider.CreateProtector(
                    nameof(OpenIdConnectServerHandler),
                    nameof(Options.AuthorizationCodeFormat), Options.AuthenticationType);

                Options.AuthorizationCodeFormat = new AspNetTicketDataFormat(new DataProtectorShim(protector));
            }

            if (Options.RefreshTokenFormat == null)
            {
                var protector = Options.DataProtectionProvider.CreateProtector(
                    nameof(OpenIdConnectServerHandler),
                    nameof(Options.RefreshTokenFormat), Options.AuthenticationType);

                Options.RefreshTokenFormat = new AspNetTicketDataFormat(new DataProtectorShim(protector));
            }

            var environment = new AppProperties(properties).Get <string>("host.AppMode");

            if (Options.AllowInsecureHttp && !string.Equals(environment, "Development", StringComparison.OrdinalIgnoreCase))
            {
                Options.Logger.LogWarning("Disabling the transport security requirement is not recommended in production. " +
                                          "Consider setting 'OpenIdConnectServerOptions.AllowInsecureHttp' to 'false' " +
                                          "to prevent the OpenID Connect server middleware from serving non-HTTPS requests.");
            }
        }
Esempio n. 18
0
 public RangeMiddleware(OwinMiddleware next, ServiceName serviceName, string path,
                        Func <PackageSearcherManager> searcherManagerThunk)
     : base(next, serviceName, path, searcherManagerThunk)
 {
 }
Esempio n. 19
0
 public StaticFileMiddleware(OwinMiddleware next) : base(next)
 {
 }
 public ActuatorHypermediaEndpointOwinMiddleware(OwinMiddleware next, ActuatorEndpoint endpoint, IEnumerable <IManagementOptions> mgmtOptions = null, ILogger <ActuatorHypermediaEndpointOwinMiddleware> logger = null)
     : base(next, endpoint, mgmtOptions?.OfType <ActuatorManagementOptions>(), logger: logger)
 {
     _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
 }
 public MappingsEndpointOwinMiddleware(OwinMiddleware next, IMappingsOptions options, IApiExplorer apiExplorer, ILogger logger = null)
     : base(next, logger: logger)
 {
     _options     = options;
     _apiExplorer = apiExplorer;
 }
Esempio n. 22
0
 public Logger(OwinMiddleware next) : base(next)
 {
 }
 public UrlRewriterOwinMiddleware(OwinMiddleware next, UrlRewriterOptions options)
     : base(next)
 {
     _options = options;
 }
Esempio n. 24
0
 private static AppFunc Conversion2(OwinMiddleware next)
 {
     return(new OwinMiddlewareTransition(next).Invoke);
 }
 public LogRequestInformationMiddleware(OwinMiddleware next)
     : base(next)
 {
 }
Esempio n. 26
0
 public B2COpenIdConnectAuthenticationMiddleware(OwinMiddleware next, IAppBuilder app, OpenIdConnectAuthenticationOptions options)
     : base(next, app, options)
 {
     _logger = app.CreateLogger <B2COpenIdConnectAuthenticationMiddleware>();
 }
Esempio n. 27
0
 public HttpsRedirectMiddleware(OwinMiddleware next, int httpsPort, RedirectStatusCode statusCode) : base(next)
 {
     this.httpsPort  = httpsPort;
     this.statusCode = statusCode;
 }
Esempio n. 28
0
 public NoCacheMiddleware(OwinMiddleware next)
     : base(next)
 {
 }
Esempio n. 29
0
 public LoggingContextMiddleware(OwinMiddleware next, IDictionary <string, Func <string> > requestHeaders) : base(next)
 {
     _requestHeaders = requestHeaders;
 }
Esempio n. 30
0
 public NoCacheMiddleware(OwinMiddleware next, NoCacheOptions options)
     : base(next)
 {
     _options = options;
 }
Esempio n. 31
0
 private static AppFunc Conversion2(OwinMiddleware next)
 {
     throw new NotImplementedException();
 }
Esempio n. 32
0
 public BasicAuthenticationMiddleware(OwinMiddleware next, BasicAuthenticationOptions basicAuthenticationOptions)
     : base(next, basicAuthenticationOptions)
 {
 }
 private static AppFunc Conversion2(OwinMiddleware next)
 {
     return new OwinMiddlewareTransition(next).Invoke;
 }
Esempio n. 34
0
 public ProfilesSdkCustomMiddleware(OwinMiddleware next)
     : base(next)
 {
     _next = next;
 }