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


C# IFubuRequest.Get方法代码示例

本文整理汇总了C#中IFubuRequest.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IFubuRequest.Get方法的具体用法?C# IFubuRequest.Get怎么用?C# IFubuRequest.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFubuRequest的用法示例。


在下文中一共展示了IFubuRequest.Get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RightsFor

        public AuthorizationRight RightsFor(IFubuRequest request)
        {
            var customerId = request.Get<Customer>().Id;
            var productId = request.Get<Product>().Id;

            var hasPurchasedProduct = _repository.Get<IPurchaseHistory>(customerId)
                .Any(x => x.ContainsProduct(productId));

            return !hasPurchasedProduct ? AuthorizationRight.Deny : AuthorizationRight.Allow;
        }
开发者ID:mtscout6,项目名称:fubumvc,代码行数:10,代码来源:PurchasedProductPolicy.cs

示例2: DiagnosticBehavior

        public DiagnosticBehavior(IDebugReport report, IDebugDetector detector, IRequestHistoryCache history, IDebugCallHandler debugCallHandler, IFubuRequest request)
        {
            _report = report;
            _debugCallHandler = debugCallHandler;
            _detector = detector;

            _initialize = () => history.AddReport(report, request.Get<CurrentRequest>());
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:8,代码来源:DiagnosticBehavior.cs

示例3: RightsFor

        public AuthorizationRight RightsFor(IFubuRequest request)
        {
            var athleteId = request.Get<AthleteSpecific>().AthleteId;
            var athlete = session.Load<Athlete>(athleteId);

            if (athlete.UserName == secContext.CurrentIdentity.Name)
                return AuthorizationRight.Allow;
            return AuthorizationRight.Deny;
        }
开发者ID:eatsleeptraincode,项目名称:crossfit204scoreboard,代码行数:9,代码来源:UserPolicy.cs

示例4: RightsFor

        public AuthorizationRight RightsFor(IFubuRequest request)
        {
            var authToken = request.Get<AuthenticationTokenRequest>();

            //Workaround: RightsFor is getting called multiple times because of a Fubu bug
            if(request.Has<IAuthenticationToken>()) return AuthorizationRight.Allow;

            var token = authToken.authToken;

            if(token.IsEmpty())
            {
                if(_currentSdkUser.IsAuthenticated)
                {
                    _logger.LogDebug("No AuthToken was found in this request but a user is authenticated. Using the current user's credentials.");
                    return AuthorizationRight.Allow;
                }

                return AuthorizationRight.Deny;
            }

            _logger.LogDebug("Authentication token {0} found.", token);

            var authenticationToken = _tokenRepository.RetrieveByToken(token);
            if (authenticationToken == null)
            {
                return AuthorizationRight.Deny;

            }

            _logger.LogDebug("Authentication token {0} found and validated for user {1}.", authenticationToken, authenticationToken);
            request.Set(authenticationToken);

            _currentSdkUser.SetUser(_principalFactory.CreatePrincipal(authenticationToken.Username));

            return AuthorizationRight.Allow;
        }
开发者ID:KevM,项目名称:dovetail-bootstrap,代码行数:36,代码来源:AuthenticationTokenAuthorizationPolicy.cs

示例5: SiteResourceAttacher

 public SiteResourceAttacher(ISparkViewEngine engine, IFubuRequest request)
 {
     _engine = engine;
     _request = request.Get<CurrentRequest>();
 }
开发者ID:NTCoding,项目名称:FubuRaven.NTCoding.com,代码行数:5,代码来源:ViewModifiers.cs


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