/// <summary>
        /// Adds the <see cref="SharePointAuthenticationMiddleware"/> middleware to the specified 
        /// <see cref="IApplicationBuilder"/>, which enables SharePoint OAuth token processing capabilities.
        /// This middleware understands appropriately
        /// formatted and secured tokens from SharePoint, which appear in the request header.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A  <see cref="SharePointAuthenticationOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseSharePointAuthentication(this IApplicationBuilder app, SharePointAuthenticationOptions options)
        {
            if (app == null) { throw new ArgumentNullException(nameof(app)); }
            if (options == null) { throw new ArgumentNullException(nameof(options)); }

            return app.UseMiddleware<SharePointAuthenticationMiddleware>(options);
        }
Exemple #2
0
 /// <summary>
 /// Creates new SharePointConfiguration from SharePointAuthenticationOptions.
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static SharePointConfiguration GetFromSharePointAuthenticationOptions(SharePointAuthenticationOptions options)
 {
     return(new SharePointConfiguration()
     {
         ClientId = options.ClientId,
         ClientSecret = options.ClientSecret,
         IssuerId = options.IssuerId,
         HostedAppHostNameOverride = options.HostedAppHostNameOverride,
         HostedAppHostName = options.HostedAppHostName,
         SecondaryClientSecret = options.SecondaryClientSecret,
         Realm = options.Realm,
         ClientSigningCertificatePath = options.ClientSigningCertificatePath,
         ClientSigningCertificatePassword = options.ClientSigningCertificatePassword
     });
 }
 /// <summary>
 /// Creates new SharePointConfiguration from SharePointAuthenticationOptions.
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static SharePointConfiguration GetFromSharePointAuthenticationOptions(SharePointAuthenticationOptions options)
 {
     return new SharePointConfiguration()
     {
         ClientId = options.ClientId,
         ClientSecret = options.ClientSecret,
         IssuerId = options.IssuerId,
         HostedAppHostNameOverride = options.HostedAppHostNameOverride,
         HostedAppHostName = options.HostedAppHostName,
         SecondaryClientSecret = options.SecondaryClientSecret,
         Realm = options.Realm,
         ClientSigningCertificatePath = options.ClientSigningCertificatePath,
         ClientSigningCertificatePassword = options.ClientSigningCertificatePassword
     };
 }
 public static IApplicationBuilder UseSharePointAuthentication(this IApplicationBuilder app, SharePointAuthenticationOptions options)
 {
     throw new NotSupportedException("This method is no longer supported, see https://go.microsoft.com/fwlink/?linkid=845470");
 }
Exemple #5
0
        /// <summary>
        /// Adds the <see cref="SharePointAuthenticationMiddleware"/> middleware to the specified
        /// <see cref="IApplicationBuilder"/>, which enables SharePoint OAuth token processing capabilities.
        /// This middleware understands appropriately
        /// formatted and secured tokens from SharePoint, which appear in the request header.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A  <see cref="SharePointAuthenticationOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseSharePointAuthentication(this IApplicationBuilder app, SharePointAuthenticationOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.UseMiddleware <SharePointAuthenticationMiddleware>(options));
        }