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


C# IExecutionContext.Authenticate方法代码示例

本文整理汇总了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);
 }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:7,代码来源:Signout.cs

示例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));
        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:29,代码来源:Signin.cs

示例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");
        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:12,代码来源:Logoff.cs

示例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");
        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:13,代码来源:Logon.cs

示例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));
        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:23,代码来源:Signin.cs


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