本文整理汇总了C#中IAuthenticationService.GetAuthenticatedUser方法的典型用法代码示例。如果您正苦于以下问题:C# IAuthenticationService.GetAuthenticatedUser方法的具体用法?C# IAuthenticationService.GetAuthenticatedUser怎么用?C# IAuthenticationService.GetAuthenticatedUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAuthenticationService
的用法示例。
在下文中一共展示了IAuthenticationService.GetAuthenticatedUser方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnAuthorization
//public AuthorizationAttribute(IAuthenticationService authenticationService)
//{
// this.authenticationService = authenticationService;
//}
public void OnAuthorization(AuthorizationContext filterContext)
{
authenticationService = EngineContext.Current.Resolve<IAuthenticationService>();
if (authenticationService.GetAuthenticatedUser() == null)
{
filterContext.Result = new HttpUnauthorizedResult();
//filterContext.Result = new RedirectResult("~/Error");
}
}
示例2: UploadPackageController
public UploadPackageController(IAuthenticationService authenticationService, IUserkeyPackageService userkeyPackageService,
IUserkeyService userkeyService, IOrchardServices orchardServices, IGalleryPackageService galleryPackageService, IParameterFormatValidator parameterFormatValidator) {
_authenticationService = authenticationService;
_galleryPackageService = galleryPackageService;
_parameterFormatValidator = parameterFormatValidator;
_orchardServices = orchardServices;
_userkeyService = userkeyService;
T = NullLocalizer.Instance;
_userId = new Lazy<int>(() => _authenticationService.GetAuthenticatedUser().Id);
}
示例3: SecureSiteController
public SecureSiteController(
IOrchardServices orchardServices,
IAuthenticationService authenticationService,
IOwnerServices ownerServices,
IEmailServices emailServices)
{
_orchardServices = orchardServices;
_ownerServices = ownerServices;
_emailServices = emailServices;
//_authenticationService = authenticationService;
T = NullLocalizer.Instance;
Logger = NullLogger.Instance;
CurrentUser = authenticationService.GetAuthenticatedUser();
}
示例4: SiteController
public SiteController(
IRegistrationServices registrationServices,
IAuthenticationService authenticationService,
IUserEventHandler userEventHandler,
IEmailServices emailServices,
IListingServices listingServices)
{
_registrationServices = registrationServices;
_emailServices = emailServices;
_listingServices = listingServices;
_authenticationService = authenticationService;
_userEventHandler = userEventHandler;
Logger = NullLogger.Instance;
CurrentUser = authenticationService.GetAuthenticatedUser();
}
示例5: ItemCounterPartHandler
public ItemCounterPartHandler(ICounterService counters, IAuthenticationService auth, IOrchardServices services)
{
OnRemoved<ItemCounterPart>((ctx, part) => counters.RemoveAllCounters(part.ContentItem.Id));
OnGetDisplayShape<ItemCounterPart>((ctx, part) =>
{
var settings = part.Settings.GetModel<ItemCounterPartTypePartSettings>();
var type = part.Record == null ? settings.Type : part.Type;
// Incrementing visit counters here
var user = auth.GetAuthenticatedUser();
var site = services.WorkContext.CurrentSite;
var countUser = 0;
var countSite = 0;
var countSession = 0;
if (user != null){
countUser = ctx.DisplayType != "Detail" ?
counters.GetCounter(part.ContentItem.Id, user.Id, CounterType.Visits, CounterStoreType.Database)
: counters.Increment(part.ContentItem.Id, user.Id, CounterType.Visits, CounterStoreType.Database);
}
if (site != null){
countSite = ctx.DisplayType != "Detail" ?
counters.GetCounter(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Database)
: counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Database);
}
if (site != null && services.WorkContext.HttpContext != null){
countSession = ctx.DisplayType != "Detail" ?
counters.GetCounter(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Session)
: counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Session);
}
/* Setting appropriate counter */
part.Count = (type == VisitCounterType.PerSite)
? countSite
: (type == VisitCounterType.PerUser &&
user != null)
? countUser
: countSession;
});
}
示例6: CountersHandler
public CountersHandler(ICounterService counters, IAuthenticationService auth, IOrchardServices services)
{
OnRemoved<AutoroutePart>((ctx, part) => counters.RemoveAllCounters(part.ContentItem.Id));
OnGetDisplayShape<AutoroutePart>((ctx, part) =>
{
if (ctx.DisplayType != "Detail") return;
// Avoiding double incrementing counter for route parts and itemcounter parts
if (part.Is<ItemCounterPart>()) return;
// Incrementing visit counters here
var user = auth.GetAuthenticatedUser();
var site = services.WorkContext.CurrentSite;
if (user != null)
counters.Increment(part.ContentItem.Id, user.Id, CounterType.Visits, CounterStoreType.Database);
if (site != null)
counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Database);
if (site != null && services.WorkContext.HttpContext != null)
counters.Increment(part.ContentItem.Id, site.Id, CounterType.Visits, CounterStoreType.Session);
});
}
示例7: BaseService
public BaseService(IAuthenticationService authenticationService)
{
CurrentUser = authenticationService.GetAuthenticatedUser();
Logger = NullLogger.Instance;
}
示例8: BaseService
public BaseService(IAuthenticationService authenticationService)
{
CurrentUser = authenticationService.GetAuthenticatedUser();
}