I want to “sense” that you are in backoffice and/or editmode. How do I do this?
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class B2BAuthorizationAttribute : AuthorizeAttribute
protected override bool AuthorizeCore(HttpContextBase httpContext)
var isAuthenticated = httpContext.User.Identity.IsAuthenticated;
var personStorage = IoC.Resolve<PersonStorage>();
if (personStorage.CurrentSelectedOrganization != null || SecurityToken.CurrentSecurityToken.IsSystemUser)
var loginService = IoC.Resolve<LoginService>();
Litium version: 7.3.2
Describe the scenario please, what are you trying to achieve?
RouteRequestLookupInfo object has a property
.IsInAdministration that’s set to true when visiting a page in back office. Maybe that’s enough for your use case?
I want to force the customer to be connected to a organization when not in backoffice, otherwise we log them out.
Is that really available in a Attribute though?
You can use IoC to resolve it.
var routeRequestLookupInfo = IoC.Resolve<RouteRequestLookupInfoAccessor>().RouteRequestLookupInfo;
You can see it in
OrganizationRoleAttribute class in the default Accelerator.
I just figured that out when you wrote back
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.