Authorization.Kentico.MVC.DynamicRouting
12.29.1
See the version list below for details.
dotnet add package Authorization.Kentico.MVC.DynamicRouting --version 12.29.1
NuGet\Install-Package Authorization.Kentico.MVC.DynamicRouting -Version 12.29.1
<PackageReference Include="Authorization.Kentico.MVC.DynamicRouting" Version="12.29.1" />
paket add Authorization.Kentico.MVC.DynamicRouting --version 12.29.1
#r "nuget: Authorization.Kentico.MVC.DynamicRouting, 12.29.1"
// Install Authorization.Kentico.MVC.DynamicRouting as a Cake Addin #addin nuget:?package=Authorization.Kentico.MVC.DynamicRouting&version=12.29.1 // Install Authorization.Kentico.MVC.DynamicRouting as a Cake Tool #tool nuget:?package=Authorization.Kentico.MVC.DynamicRouting&version=12.29.1
Kentico Authorization Attribute
Kentico Authorization Attribute for Kentico MVC, provides a [KenticoAuthorize] Attribute that you can add to your ActionResult methods that can allows for permissions on:
- User Authenticated
- User Names
- User Roles
- Page ACL Permissions (May require custom handling, see
Events
section below) - Resource/Module Permissions
It also allows for a custom Unauthorized Redirect path in case you need to specify a specific location to send unauthorized users.
Installation
- Install the
Authorization.Kentico.MVC
NuGet Package to your MVC Site - Overwrite any Events if you need (expecially the GetPage)
- Add
[KenticoAuthorize()]
attributes to your ActionResult methods.
Usage
- Add the
[KenticoAuthorize()]
Attribute to your ActionResult and pass in any properties you wish to configure.
Events
The Authorization Module has 4 events you can hook into in order to customize it's behavior.
AuthorizeEvents.GetPage
This allows you to modify the retrieval of the current page. By default, it will try to find the page based on the relative path with a match on the NodeAliasPath.
AuthorizeEvents.GetCulture
This allows you to modify the retrieval of the current culture. This is used in the GetPage logic to get the proper TreeNode. By default, It will use the PreviewCulture (if in preview), LocalizationContext.CurrentCulture, and lastly the System.Globalization.CultureInfo.CurrentCulture.Name.
AuthorizeEvents.GetUser
This allows you to modify the retrieval of the current user. By default it will use the HttpContext.User.Identity to get the UserName of the current user. Public is the default user if none found or the found user is disabled.
AuthorizeEvents.Authorizing
This allows you to modify the Authorizing logic itself. By default it will perform all the proper checks on User, Role, Module Permissions, Page ACL, and user allowed cultures. If you do overwrite, you must set SkipDefaultValidation
to true in the AuthorizingEventArgs.
Compatability
Can be used on any Kentico 12 SP site (hotfix 29 or above).
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- AngleSharp (>= 0.9.9.2)
- Antlr (>= 3.5.0.2)
- DynamicRouting.Kentico.MVC (>= 12.29.12)
- Kentico.AspNet.Mvc (>= 12.0.29)
- Microsoft.AspNet.Razor (>= 3.2.7)
- Microsoft.AspNet.WebPages (>= 3.2.7)
- Microsoft.CSharp (>= 4.4.1)
- Microsoft.Owin.Security (>= 3.1.0)
- Microsoft.Owin.Security.Cookies (>= 3.1.0)
- Microsoft.Owin.Security.OAuth (>= 3.1.0)
- Microsoft.Web.Xdt (>= 2.1.1)
- Newtonsoft.Json (>= 11.0.2)
- WebGrease (>= 1.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Updated to use BaseDynamicRouteHelper to get the page.