OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.44k stars 2.4k forks source link

Action on user log in #6347

Closed micnyk closed 6 months ago

micnyk commented 4 years ago

Hi, I would like to perform an action when user logs in. It's about to check user's groups in Azure Active Directory and assign roles depending on those groups. How can I do that using Orchard Core builtin Azure Active Directory Authentication?

jptissot commented 4 years ago

Yes, I believe there is a script that runs on login. Check the user's settings in the admin interface.

micnyk commented 4 years ago

@jptissot I found IUserEventHandler interface which would be a great fit but I can't access it from my module :/ I tried installing OrchardCore.Users, OrchardCore.Users.Abstraction packages but still can't implement this interface in my module.

MichaelPetrinolis commented 4 years ago

Hi @micnyk, as @jptissot mentioned, you could use server side javascript to define the roles based on the claims received or register an implementation of IExternalLoginEventHandler in a module

jptissot commented 4 years ago

@micnyk were you able to fix your issue ?