Пример #1
0
        /// <summary>
        /// Adds a new instance of the OAuth2 introspection middleware in the OWIN/Katana pipeline.
        /// </summary>
        /// <param name="app">The application builder.</param>
        /// <param name="options">The options used to configure the introspection middleware.</param>
        /// <returns>The application builder.</returns>
        public static IAppBuilder UseOAuthIntrospection(
            [NotNull] this IAppBuilder app,
            [NotNull] OAuthIntrospectionOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.Use <OAuthIntrospectionMiddleware>(app.Properties, options));
        }
Пример #2
0
        /// <summary>
        /// Adds a new instance of the OAuth2 introspection middleware in the OWIN/Katana pipeline.
        /// </summary>
        /// <param name="app">The application builder.</param>
        /// <param name="configuration">The delegate used to configure the introspection options.</param>
        /// <returns>The application builder.</returns>
        public static IAppBuilder UseOAuthIntrospection(
            [NotNull] this IAppBuilder app,
            [NotNull] Action <OAuthIntrospectionOptions> configuration)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var options = new OAuthIntrospectionOptions();

            configuration(options);

            return(app.UseOAuthIntrospection(options));
        }
Пример #3
0
        /// <summary>
        /// Configures the OAuth2 introspection middleware to enable logging.
        /// </summary>
        /// <param name="options">The options used to configure the OAuth2 introspection middleware.</param>
        /// <param name="configuration">The delegate used to configure the logger factory.</param>
        /// <returns>The options used to configure the OAuth2 introspection middleware.</returns>
        public static OAuthIntrospectionOptions UseLogging(
            [NotNull] this OAuthIntrospectionOptions options,
            [NotNull] Action <ILoggerFactory> configuration)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var factory = new LoggerFactory();

            configuration(factory);

            options.Logger = factory.CreateLogger <OAuthIntrospectionMiddleware>();

            return(options);
        }