本文整理汇总了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;
}
示例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>());
}
示例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;
}
示例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;
}
示例5: SiteResourceAttacher
public SiteResourceAttacher(ISparkViewEngine engine, IFubuRequest request)
{
_engine = engine;
_request = request.Get<CurrentRequest>();
}