本文整理汇总了C#中IExecutionContext.Authenticate方法的典型用法代码示例。如果您正苦于以下问题:C# IExecutionContext.Authenticate方法的具体用法?C# IExecutionContext.Authenticate怎么用?C# IExecutionContext.Authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExecutionContext
的用法示例。
在下文中一共展示了IExecutionContext.Authenticate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoProcessRequest
public override void DoProcessRequest(IExecutionContext context)
{
// The runtime will react to the null by setting the Anonymous
// profile as the current user. the other option is the Abandon
// method on the context.
context.Authenticate(null);
}
示例2: DoProcessRequest
public override void DoProcessRequest(IExecutionContext context)
{
userProfile profile = UserHelper.Instance.LoadUser(username);
if (profile == null || !profile.Authenticate(password))
{
ReportError(null, "The user name or password is incorrect");
return;
}
else
// this is the key line. this sets the profile as the
// current user, and marks the session as authenticated
context.Authenticate(profile);
if (ContentTypeHelper.Instance.Parse(defaultContentType) != profile.UserType.ContentType)
defaultContentType = ContentTypeHelper.Instance.GetSimpleName(profile.UserType.ContentType);
// hack. we didn't create a table to store the roles, so now
// we're faking them through here
if (profile.UserType.Equals(UserType.Company)) {
var node = profile.role.AppendNode();
node.Name = "company";
}
if (String.IsNullOrEmpty(originalRequest))
context.Transfer("/default");
else
context.Transfer(HttpUtility.UrlDecode(originalRequest));
}
示例3: DoProcessRequest
/// <summary>
/// Controller implementation. User signout is performed by calling Authenticate with null as the
/// user.
/// </summary>
/// <param name="context">The context.</param>
public override void DoProcessRequest(IExecutionContext context)
{
FormsAuth.SignOut();
context.Authenticate(null);
context.Transfer("home/index");
}
示例4: DoProcessRequest
/// <summary>
/// Controller implementation
/// </summary>
/// <param name="context">The context.</param>
public override void DoProcessRequest(IExecutionContext context)
{
if (!ValidateLogon())
return;
context.Authenticate(FormsAuth.SignIn(username, rememberMe));
context.Transfer("/home/index");
}
示例5: DoProcessRequest
public override void DoProcessRequest(IExecutionContext context)
{
UserProfile profile = UserDataAccess.Instance.LoadUser(username);
if (profile == null || !profile.Authenticate(password))
{
ReportError(null, "The user name or password is incorrect");
return;
}
else
// this is the key line. this sets the profile as the
// current user, and marks the session as authenticated
context.Authenticate(profile);
ContentType userContentType = UserTypeUtility.AsContentType(profile.UserType);
if (ContentTypeUtility.FromString(defaultContentType) != userContentType)
defaultContentType = ContentTypeUtility.AsString(userContentType);
if (String.IsNullOrEmpty(originalRequest))
context.Transfer("/default");
else
context.Transfer(HttpUtility.UrlDecode(originalRequest));
}