当前位置: 首页>>代码示例>>C#>>正文


C# IAuthenticationService.GetAuthenticatedUser方法代码示例

本文整理汇总了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");
     }
 }
开发者ID:AgileEAP,项目名称:AgileEAP-BPM,代码行数:13,代码来源:AuthorizationFilter.cs

示例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);
        }
开发者ID:NickAndersonX,项目名称:xodb,代码行数:11,代码来源:UploadPackageController.cs

示例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();
 }
开发者ID:ivNetAdmin,项目名称:ivNet.Listing.v1.9.0,代码行数:14,代码来源:SecureSiteController.cs

示例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();
 }
开发者ID:ivNetAdmin,项目名称:ivNet.Listing.v1.9.0,代码行数:15,代码来源:SiteController.cs

示例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;
            });
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:40,代码来源:ItemCounterPartHandler.cs

示例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);
            });
        }
开发者ID:richinoz,项目名称:Orchard1.6,代码行数:23,代码来源:CountersHandler.cs

示例7: BaseService

 public BaseService(IAuthenticationService authenticationService)
 {
     CurrentUser = authenticationService.GetAuthenticatedUser();
     Logger = NullLogger.Instance;
 }
开发者ID:ivNetAdmin,项目名称:ivNet.Club.v.1.9.1,代码行数:5,代码来源:BaseService.cs

示例8: BaseService

 public BaseService(IAuthenticationService authenticationService)
 {
     CurrentUser = authenticationService.GetAuthenticatedUser();
 }
开发者ID:ivNetAdmin,项目名称:ivNet.Listing.v1.9.0,代码行数:4,代码来源:BaseService.cs


注:本文中的IAuthenticationService.GetAuthenticatedUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。