Inheritance: Microsoft.AspNetCore.Builder.RemoteAuthenticationOptions
        /// <summary>
        /// Adds <see cref="OpenIdAuthenticationMiddleware{TOptions}"/> to the specified
        /// <see cref="IApplicationBuilder"/>, which enables OpenID2 authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/>.</param>
        /// <param name="configuration">The delegate used to configure the OAuth2 options.</param>
        /// <returns>The <see cref="IApplicationBuilder"/>.</returns>
        public static IApplicationBuilder UseOpenIdAuthentication(
            [NotNull] this IApplicationBuilder app,
            [NotNull] Action<OpenIdAuthenticationOptions> configuration) {
            if (app == null) {
                throw new ArgumentNullException(nameof(app));
            }

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

            var options = new OpenIdAuthenticationOptions();
            configuration(options);

            return app.UseMiddleware<OpenIdAuthenticationMiddleware<OpenIdAuthenticationOptions>>(Options.Create(options));
        }