Revamped package specifically for .Net core and republished as XperienceCommunity.Authorization. See package site for quick migration steps.
NuGet\Install-Package Authorization.Kentico.MVC.Core -Version 13.0.1
dotnet add package Authorization.Kentico.MVC.Core --version 13.0.1
<PackageReference Include="Authorization.Kentico.MVC.Core" Version="13.0.1" />
paket add Authorization.Kentico.MVC.Core --version 13.0.1
#r "nuget: Authorization.Kentico.MVC.Core, 13.0.1"
// Install Authorization.Kentico.MVC.Core as a Cake Addin #addin nuget:?package=Authorization.Kentico.MVC.Core&version=13.0.1 // Install Authorization.Kentico.MVC.Core as a Cake Tool #tool nuget:?package=Authorization.Kentico.MVC.Core&version=13.0.1
Kentico Authorization Attribute
For Kentico 13 .Net Core only!
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
- 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.
- Install the
Authorization.Kentico.MVC.CoreNuGet Package to your MVC Site
- Overwrite any Events if you need (especially the GetPage)
[KenticoAuthorize()]attributes to your ActionResult methods.
- Add the
[KenticoAuthorize()]Attribute to your ActionResult and pass in any properties you wish to configure.
The Authorization Module has 4 events you can hook into in order to customize it's behavior.
This allows you to modify the retrieval of the current page. By default, it will try to find the page based on Kentico's Page Builder Context, then by the relative path with a match on the NodeAliasPath.
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.
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.
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.
Can be used on any Kentico 13 .net Core site.
|.NET||net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows|
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
Unauthorized and Not Authenticated results were not properly executing, adjusted code to properly execute these, it now uses the ConfigureApplicationCookie's LoginPath and AccessDeniedPath (usually configured in Startup.cs)