コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TContext"></typeparam>
        /// <param name="actionContext"></param>
        /// <param name="principal"></param>
        public static void SetPrincipalInContext <TContext>(ActionContextBase <TContext> actionContext, IGenericTokenPrincipal principal) where TContext : ActionContextBase <TContext>, new()
        {
            actionContext.NullCheck("actionContext");
            principal.NullCheck("principal");

            GenericTicketTokenContainer container = principal.GetGenericTicketTokenContainer();

            GenericTicketPrincipal genericPrincipal = new GenericTicketPrincipal(container.User, container.RealUser);

            actionContext.Context["Principal"] = genericPrincipal;
        }