V14: Invalidate user tokens (#15651)
* Adding revoke user auth token handler and registering it * Maintain method clarity by grouping new calls into its own method * Rename functions to what they do * Suggested linq function of tripple nesting * Reduce nesting by early loop continuation * Fix PR suggestion async typo * Review suggestions * Log msg alignment between members and users --------- Co-authored-by: Sven Geusens <sge@umbraco.dk>
This commit is contained in:
committed by
GitHub
parent
71b3076de9
commit
8c6e03d346
@@ -1,10 +1,12 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Api.Common.DependencyInjection;
|
||||
using Umbraco.Cms.Api.Management.Handlers;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Api.Management.Middleware;
|
||||
using Umbraco.Cms.Api.Management.Security;
|
||||
using Umbraco.Cms.Core.Notifications;
|
||||
using Umbraco.Cms.Infrastructure.Security;
|
||||
using Umbraco.Cms.Web.Common.ApplicationBuilder;
|
||||
|
||||
@@ -17,7 +19,19 @@ public static class BackOfficeAuthBuilderExtensions
|
||||
builder
|
||||
.AddAuthentication()
|
||||
.AddUmbracoOpenIddict()
|
||||
.AddBackOfficeLogin();
|
||||
.AddBackOfficeLogin()
|
||||
.AddTokenRevocation();
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
private static IUmbracoBuilder AddTokenRevocation(this IUmbracoBuilder builder)
|
||||
{
|
||||
builder.AddNotificationAsyncHandler<UserSavingNotification, RevokeUserAuthenticationTokensNotificationHandler>();
|
||||
builder.AddNotificationAsyncHandler<UserSavedNotification, RevokeUserAuthenticationTokensNotificationHandler>();
|
||||
builder.AddNotificationAsyncHandler<UserDeletedNotification, RevokeUserAuthenticationTokensNotificationHandler>();
|
||||
builder.AddNotificationAsyncHandler<UserGroupDeletingNotification, RevokeUserAuthenticationTokensNotificationHandler>();
|
||||
builder.AddNotificationAsyncHandler<UserGroupDeletedNotification, RevokeUserAuthenticationTokensNotificationHandler>();
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user