From fd54c5af212d9cbf1340c715ddf513a9ba5dd004 Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Mon, 19 Oct 2015 11:50:10 -0700 Subject: [PATCH] Add lots of missing doc comments. Also did some minor renames to match extension method patterns. --- .../CookieAppBuilderExtensions.cs | 24 ++++++++-------- .../CookieServiceCollectionExtensions.cs | 16 +++++++++-- .../FacebookAppBuilderExtensions.cs | 17 +++++------ .../GoogleAppBuilderExtensions.cs | 21 +++++++------- .../JwtBearerAppBuilderExtensions.cs | 20 +++++++------ .../MicrosoftAccountAppBuilderExtensions.cs | 16 +++++++++-- ...nsions.cs => OAuthAppBuilderExtensions.cs} | 20 ++++++------- ...s => OpenIdConnectAppBuilderExtensions.cs} | 20 ++++++------- .../TwitterAppBuilderExtensions.cs | 15 ++++++++-- ...thenticationServiceCollectionExtensions.cs | 14 ++++++++++ ...laimsTransformationAppBuilderExtensions.cs | 28 +++++++++---------- .../AllowAnonymousAttribute.cs | 3 ++ ...uthorizationServiceCollectionExtensions.cs | 16 ++++++++++- .../AuthorizeAttribute.cs | 13 +++++++++ .../IAuthorizeData.cs | 9 ++++++ .../CookiePolicyAppBuilderExtensions.cs | 18 ++++++------ 16 files changed, 180 insertions(+), 90 deletions(-) rename src/Microsoft.AspNet.Authentication.OAuth/{OAuthExtensions.cs => OAuthAppBuilderExtensions.cs} (61%) rename src/Microsoft.AspNet.Authentication.OpenIdConnect/{OpenIdConnectExtensions.cs => OpenIdConnectAppBuilderExtensions.cs} (54%) diff --git a/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs index ef4a252a39..0a8cd12ce4 100644 --- a/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Cookies/CookieAppBuilderExtensions.cs @@ -7,15 +7,15 @@ using Microsoft.AspNet.Authentication.Cookies; namespace Microsoft.AspNet.Builder { /// - /// Extension methods provided by the cookies authentication middleware + /// Extension methods to add cookie authentication capabilities to an HTTP application pipeline. /// public static class CookieAppBuilderExtensions { /// - /// Adds a cookie-based authentication middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables cookie authentication capabilities. /// - /// The IApplicationBuilder passed to your configuration method - /// The original app parameter + /// The to add the middleware to. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseCookieAuthentication(this IApplicationBuilder app) { if (app == null) @@ -27,11 +27,11 @@ namespace Microsoft.AspNet.Builder } /// - /// Adds a cookie-based authentication middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables cookie authentication capabilities. /// - /// The IApplicationBuilder passed to your configuration method - /// Used to configure the options for the middleware - /// The original app parameter + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseCookieAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) @@ -48,11 +48,11 @@ namespace Microsoft.AspNet.Builder } /// - /// Adds a cookie-based authentication middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables cookie authentication capabilities. /// - /// The IApplicationBuilder passed to your configuration method - /// Used to configure the middleware - /// The original app parameter + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseCookieAuthentication(this IApplicationBuilder app, CookieAuthenticationOptions options) { if (app == null) diff --git a/src/Microsoft.AspNet.Authentication.Cookies/CookieServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Authentication.Cookies/CookieServiceCollectionExtensions.cs index 260539b551..00132beac2 100644 --- a/src/Microsoft.AspNet.Authentication.Cookies/CookieServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Cookies/CookieServiceCollectionExtensions.cs @@ -8,10 +8,16 @@ using Microsoft.Extensions.Configuration; namespace Microsoft.Extensions.DependencyInjection { /// - /// Extension methods provided by the cookies authentication middleware + /// Extension methods for setting up cookie authentication services in an . /// public static class CookieServiceCollectionExtensions { + /// + /// Adds cookie authentication services to the specified . + /// + /// The to add services to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IServiceCollection AddCookieAuthentication(this IServiceCollection services, Action configure) { if (services == null) @@ -27,6 +33,12 @@ namespace Microsoft.Extensions.DependencyInjection return services.Configure(configure); } + /// + /// Adds cookie authentication services to the specified . + /// + /// The to add services to. + /// An instance that contains configuration data representing a . + /// A reference to this instance after the operation has completed. public static IServiceCollection AddCookieAuthentication(this IServiceCollection services, IConfiguration config) { if (services == null) @@ -42,4 +54,4 @@ namespace Microsoft.Extensions.DependencyInjection return services.Configure(config); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs index 0df075e356..0889ec6ece 100644 --- a/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Facebook/FacebookAppBuilderExtensions.cs @@ -7,15 +7,16 @@ using Microsoft.AspNet.Authentication.Facebook; namespace Microsoft.AspNet.Builder { /// - /// Extension methods for using . + /// Extension methods to add Facebook authentication capabilities to an HTTP application pipeline. /// public static class FacebookAppBuilderExtensions { /// - /// Authenticate users using Facebook. + /// Adds the middleware to the specified , which enables Facebook authentication capabilities. /// - /// The passed to the configure method. - /// The updated . + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseFacebookAuthentication(this IApplicationBuilder app, FacebookOptions options) { if (app == null) @@ -32,11 +33,11 @@ namespace Microsoft.AspNet.Builder } /// - /// Authenticate users using Facebook. + /// Adds the middleware to the specified , which enables Facebook authentication capabilities. /// - /// The passed to the configure method. - /// Configures the options. - /// The updated . + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseFacebookAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) diff --git a/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs index 08226c527c..67993bbc2e 100644 --- a/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Google/GoogleAppBuilderExtensions.cs @@ -7,16 +7,16 @@ using Microsoft.AspNet.Authentication.Google; namespace Microsoft.AspNet.Builder { /// - /// Extension methods for using . + /// Extension methods to add Google authentication capabilities to an HTTP application pipeline. /// public static class GoogleAppBuilderExtensions { /// - /// Authenticate users using Google OAuth 2.0. + /// Adds the middleware to the specified , which enables Google authentication capabilities. /// - /// The passed to the configure method. - /// The Middleware options. - /// The updated . + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app, GoogleOptions options) { if (app == null) @@ -33,12 +33,11 @@ namespace Microsoft.AspNet.Builder } /// - /// Authenticate users using Google OAuth 2.0. + /// Adds the middleware to the specified , which enables Google authentication capabilities. /// - /// The passed to the configure method. - /// Used to configure Middleware options. - /// Name of the options instance to be used - /// The updated . + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) @@ -54,4 +53,4 @@ namespace Microsoft.AspNet.Builder return app.UseGoogleAuthentication(options); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs index 7330aa7b3c..80494f09d8 100644 --- a/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.JwtBearer/JwtBearerAppBuilderExtensions.cs @@ -7,21 +7,22 @@ using Microsoft.AspNet.Authentication.JwtBearer; namespace Microsoft.AspNet.Builder { /// - /// Extension methods to add OpenIdConnect Bearer authentication capabilities to an HTTP application pipeline + /// Extension methods to add OpenIdConnect Bearer authentication capabilities to an HTTP application pipeline. /// public static class JwtBearerAppBuilderExtensions { /// - /// Adds Bearer token processing to an HTTP application pipeline. This middleware understands appropriately + /// Adds the middleware to the specified , which enables Bearer token processing capabilities. + /// This middleware understands appropriately /// formatted and secured tokens which appear in the request header. If the Options.AuthenticationMode is Active, the /// claims within the bearer token are added to the current request's IPrincipal User. If the Options.AuthenticationMode /// is Passive, then the current request is not modified, but IAuthenticationManager AuthenticateAsync may be used at /// any time to obtain the claims from the request's bearer token. /// See also http://tools.ietf.org/html/rfc6749 /// - /// The application builder - /// Options which control the processing of the bearer header. - /// The application builder + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseJwtBearerAuthentication(this IApplicationBuilder app, JwtBearerOptions options) { if (app == null) @@ -38,16 +39,17 @@ namespace Microsoft.AspNet.Builder } /// - /// Adds Bearer token processing to an HTTP application pipeline. This middleware understands appropriately + /// Adds the middleware to the specified , which enables Bearer token processing capabilities. + /// This middleware understands appropriately /// formatted and secured tokens which appear in the request header. If the Options.AuthenticationMode is Active, the /// claims within the bearer token are added to the current request's IPrincipal User. If the Options.AuthenticationMode /// is Passive, then the current request is not modified, but IAuthenticationManager AuthenticateAsync may be used at /// any time to obtain the claims from the request's bearer token. /// See also http://tools.ietf.org/html/rfc6749 /// - /// The application builder - /// Used to configure Middleware options. - /// The application builder + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseJwtBearerAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) diff --git a/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs index c890b7a9e2..37a8d4180d 100644 --- a/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.MicrosoftAccount/MicrosoftAccountAppBuilderExtensions.cs @@ -7,10 +7,16 @@ using Microsoft.AspNet.Authentication.MicrosoftAccount; namespace Microsoft.AspNet.Builder { /// - /// Extension methods for using + /// Extension methods to add Microsoft Account authentication capabilities to an HTTP application pipeline. /// - public static class MicrosoftAccountAuthenticationExtensions + public static class MicrosoftAccountAppBuilderExtensions { + /// + /// Adds the middleware to the specified , which enables Microsoft Account authentication capabilities. + /// + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseMicrosoftAccountAuthentication(this IApplicationBuilder app, MicrosoftAccountOptions options) { if (app == null) @@ -26,6 +32,12 @@ namespace Microsoft.AspNet.Builder return app.UseMiddleware(options); } + /// + /// Adds the middleware to the specified , which enables Microsoft Account authentication capabilities. + /// + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseMicrosoftAccountAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) diff --git a/src/Microsoft.AspNet.Authentication.OAuth/OAuthExtensions.cs b/src/Microsoft.AspNet.Authentication.OAuth/OAuthAppBuilderExtensions.cs similarity index 61% rename from src/Microsoft.AspNet.Authentication.OAuth/OAuthExtensions.cs rename to src/Microsoft.AspNet.Authentication.OAuth/OAuthAppBuilderExtensions.cs index ecc03f428e..18aa623624 100644 --- a/src/Microsoft.AspNet.Authentication.OAuth/OAuthExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.OAuth/OAuthAppBuilderExtensions.cs @@ -7,16 +7,16 @@ using Microsoft.AspNet.Authentication.OAuth; namespace Microsoft.AspNet.Builder { /// - /// Extension methods for using + /// Extension methods to add OAuth 2.0 authentication capabilities to an HTTP application pipeline. /// - public static class OAuthExtensions + public static class OAuthAppBuilderExtensions { /// - /// Authenticate users using OAuth. + /// Adds the middleware to the specified , which enables OAuth 2.0 authentication capabilities. /// - /// The passed to the configure method. - /// Configures the middleware options. - /// The updated . + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseOAuthAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) @@ -38,11 +38,11 @@ namespace Microsoft.AspNet.Builder } /// - /// Authenticate users using OAuth. + /// Adds the middleware to the specified , which enables OAuth 2.0 authentication capabilities. /// - /// The passed to the configure method. - /// The middleware configuration options. - /// The updated . + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseOAuthAuthentication(this IApplicationBuilder app, OAuthOptions options) { if (app == null) diff --git a/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectExtensions.cs b/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectAppBuilderExtensions.cs similarity index 54% rename from src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectExtensions.cs rename to src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectAppBuilderExtensions.cs index 20fc9c85ea..f9b064137f 100644 --- a/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.OpenIdConnect/OpenIdConnectAppBuilderExtensions.cs @@ -7,16 +7,16 @@ using Microsoft.AspNet.Authentication.OpenIdConnect; namespace Microsoft.AspNet.Builder { /// - /// Extension methods for using + /// Extension methods to add OpenID Connect authentication capabilities to an HTTP application pipeline. /// - public static class OpenIdConnectExtensions + public static class OpenIdConnectAppBuilderExtensions { /// - /// Adds the into the ASP.NET runtime. + /// Adds the middleware to the specified , which enables OpenID Connect authentication capabilities. /// - /// The application builder - /// Options which control the processing of the OpenIdConnect protocol and token validation. - /// The application builder + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseOpenIdConnectAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) @@ -34,11 +34,11 @@ namespace Microsoft.AspNet.Builder } /// - /// Adds the into the ASP.NET runtime. + /// Adds the middleware to the specified , which enables OpenID Connect authentication capabilities. /// - /// The application builder - /// Options which control the processing of the OpenIdConnect protocol and token validation. - /// The application builder + /// The to add the middleware to. + /// An that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseOpenIdConnectAuthentication(this IApplicationBuilder app, OpenIdConnectOptions options) { if (app == null) diff --git a/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs index baef3e96a8..efff5937ae 100644 --- a/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication.Twitter/TwitterAppBuilderExtensions.cs @@ -7,10 +7,16 @@ using Microsoft.AspNet.Authentication.Twitter; namespace Microsoft.AspNet.Builder { /// - /// Extension methods for using + /// Extension methods to add Twitter authentication capabilities to an HTTP application pipeline. /// public static class TwitterAppBuilderExtensions { + /// + /// Adds the middleware to the specified , which enables Twitter authentication capabilities. + /// + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseTwitterAuthentication(this IApplicationBuilder app, Action configureOptions = null) { if (app == null) @@ -26,6 +32,12 @@ namespace Microsoft.AspNet.Builder return app.UseTwitterAuthentication(options); } + /// + /// Adds the middleware to the specified , which enables Twitter authentication capabilities. + /// + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseTwitterAuthentication(this IApplicationBuilder app, TwitterOptions options) { if (app == null) @@ -40,6 +52,5 @@ namespace Microsoft.AspNet.Builder return app.UseMiddleware(options); } - } } diff --git a/src/Microsoft.AspNet.Authentication/AuthenticationServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Authentication/AuthenticationServiceCollectionExtensions.cs index a9ee391788..72032f53b0 100644 --- a/src/Microsoft.AspNet.Authentication/AuthenticationServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Authentication/AuthenticationServiceCollectionExtensions.cs @@ -6,8 +6,16 @@ using Microsoft.AspNet.Authentication; namespace Microsoft.Extensions.DependencyInjection { + /// + /// Extension methods for setting up authentication services in an . + /// public static class AuthenticationServiceCollectionExtensions { + /// + /// Adds authentication services to the specified . + /// + /// The to add services to. + /// A reference to this instance after the operation has completed. public static IServiceCollection AddAuthentication(this IServiceCollection services) { if (services == null) @@ -20,6 +28,12 @@ namespace Microsoft.Extensions.DependencyInjection return services; } + /// + /// Adds authentication services to the specified . + /// + /// The to add services to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IServiceCollection AddAuthentication(this IServiceCollection services, Action configureOptions) { if (services == null) diff --git a/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs b/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs index def2c935ba..4086c95915 100644 --- a/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Authentication/ClaimsTransformationAppBuilderExtensions.cs @@ -9,27 +9,27 @@ using Microsoft.AspNet.Authentication; namespace Microsoft.AspNet.Builder { /// - /// Extension methods provided by the claims transformation authentication middleware + /// Extension methods to add claims transformation capabilities to an HTTP application pipeline. /// public static class ClaimsTransformationAppBuilderExtensions { /// - /// Adds a claims transformation middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables claims transformation capabilities. /// - /// The options for the middleware - /// The IApplicationBuilder passed to your configuration method - /// The original app parameter + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, ClaimsTransformationOptions options) { return app.UseMiddleware(options); } /// - /// Adds a claims transformation middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables claims transformation capabilities. /// - /// The options for the middleware - /// The IApplicationBuilder passed to your configuration method - /// The original app parameter + /// The to add the middleware to. + /// A function that asynchronously transforms one to another. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, Func> transform) { var options = new ClaimsTransformationOptions(); @@ -41,11 +41,11 @@ namespace Microsoft.AspNet.Builder } /// - /// Adds a claims transformation middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables claims transformation capabilities. /// - /// The IApplicationBuilder passed to your configuration method - /// Used to configure the options for the middleware - /// The original app parameter + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseClaimsTransformation(this IApplicationBuilder app, Action configureOptions) { var options = new ClaimsTransformationOptions(); @@ -56,4 +56,4 @@ namespace Microsoft.AspNet.Builder return app.UseClaimsTransformation(options); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs b/src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs index 30d0c49444..b61a01446b 100644 --- a/src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs +++ b/src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs @@ -5,6 +5,9 @@ using System; namespace Microsoft.AspNet.Authorization { + /// + /// Specifies that the class or method that this attribute is applied to does not require authorization. + /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class AllowAnonymousAttribute : Attribute, IAllowAnonymous { diff --git a/src/Microsoft.AspNet.Authorization/AuthorizationServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Authorization/AuthorizationServiceCollectionExtensions.cs index f00d44a59c..cbf0b922aa 100644 --- a/src/Microsoft.AspNet.Authorization/AuthorizationServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Authorization/AuthorizationServiceCollectionExtensions.cs @@ -7,8 +7,16 @@ using Microsoft.Extensions.DependencyInjection.Extensions; namespace Microsoft.Extensions.DependencyInjection { + /// + /// Extension methods for setting up authorization services in an . + /// public static class AuthorizationServiceCollectionExtensions { + /// + /// Adds authorization services to the specified . + /// + /// The to add services to. + /// A reference to this instance after the operation has completed. public static IServiceCollection AddAuthorization(this IServiceCollection services) { if (services == null) @@ -22,6 +30,12 @@ namespace Microsoft.Extensions.DependencyInjection return services; } + /// + /// Adds authorization services to the specified . + /// + /// The to add services to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IServiceCollection AddAuthorization(this IServiceCollection services, Action configure) { if (services == null) @@ -38,4 +52,4 @@ namespace Microsoft.Extensions.DependencyInjection return services.AddAuthorization(); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNet.Authorization/AuthorizeAttribute.cs b/src/Microsoft.AspNet.Authorization/AuthorizeAttribute.cs index cffc17dbd5..a20436ce99 100644 --- a/src/Microsoft.AspNet.Authorization/AuthorizeAttribute.cs +++ b/src/Microsoft.AspNet.Authorization/AuthorizeAttribute.cs @@ -5,21 +5,34 @@ using System; namespace Microsoft.AspNet.Authorization { + /// + /// Specifies that the class or method that this attribute is applied to requires the specified authorization. + /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] public class AuthorizeAttribute : Attribute, IAuthorizeData { + /// + /// Initializes a new instance of the class. + /// public AuthorizeAttribute() { } + /// + /// Initializes a new instance of the class with the specified policy. + /// + /// The name of the policy to require for authorization. public AuthorizeAttribute(string policy) { Policy = policy; } + /// public string Policy { get; set; } + /// // REVIEW: can we get rid of the , deliminated in Roles/AuthTypes public string Roles { get; set; } + /// public string ActiveAuthenticationSchemes { get; set; } } } diff --git a/src/Microsoft.AspNet.Authorization/IAuthorizeData.cs b/src/Microsoft.AspNet.Authorization/IAuthorizeData.cs index 2571fb28e7..a49b4892a1 100644 --- a/src/Microsoft.AspNet.Authorization/IAuthorizeData.cs +++ b/src/Microsoft.AspNet.Authorization/IAuthorizeData.cs @@ -3,10 +3,19 @@ namespace Microsoft.AspNet.Authorization { + /// + /// Defines the set of data required to apply authorization rules to a resource. + /// public interface IAuthorizeData { + /// + /// Gets or sets the policy name that determines access to the resource. + /// string Policy { get; set; } + /// + /// Gets or sets a comma-separated list of roles that are allowed to access the resource. + /// string Roles { get; set; } string ActiveAuthenticationSchemes { get; set; } diff --git a/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs b/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs index aa8c9af016..f8a4af52f0 100644 --- a/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs +++ b/src/Microsoft.AspNet.CookiePolicy/CookiePolicyAppBuilderExtensions.cs @@ -7,27 +7,27 @@ using Microsoft.AspNet.CookiePolicy; namespace Microsoft.AspNet.Builder { /// - /// Extension methods provided by the cookie policy middleware + /// Extension methods to add cookie policy capabilities to an HTTP application pipeline. /// public static class CookiePolicyAppBuilderExtensions { /// - /// Adds a cookie policy middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables cookie policy capabilities. /// - /// The IApplicationBuilder passed to your configuration method - /// The options for the middleware - /// The original app parameter + /// The to add the middleware to. + /// A that specifies options for the middleware. + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, CookiePolicyOptions options) { return app.UseMiddleware(options); } /// - /// Adds a cookie policy middleware to your web application pipeline. + /// Adds the middleware to the specified , which enables cookie policy capabilities. /// - /// The IApplicationBuilder passed to your configuration method - /// Used to configure the options for the middleware - /// The original app parameter + /// The to add the middleware to. + /// An action delegate to configure the provided . + /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, Action configureOptions) { var options = new CookiePolicyOptions();