示例#1
0
        public string getMockToken()
        {
            AuthenticationInstance ai = new AuthenticationInstance();

            ai.UserName  = "******";
            ai.PassWord  = "******";
            ai.TimeStamp = 1;
            return(AuthenticationUtil.GenCookieToken(ai));
        }
示例#2
0
        static void Main(string[] args)
        {
            AuthenticationInstance ai = new AuthenticationInstance();

            ai.UserName  = "******";
            ai.PassWord  = "******";
            ai.TimeStamp = 1;
            string token = AuthenticationUtil.GenCookieToken(ai);

            AuthenticationUtil.Verify(token);
        }
示例#3
0
        static void Main(string[] args)
        {
            string json = "{\"UserName\":\"a\",\"PassWord\":\"b@@##$?b\",\"TimeStamp\":1}";
            DataContractJsonSerializer ser =
                new DataContractJsonSerializer(typeof(AuthenticationInstance));
            MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json));

            AuthenticationInstance aii =
                ser.ReadObject(ms) as AuthenticationInstance;

            string token = AuthenticationUtil.GenCookieToken(aii);

            //AuthenticationUtil.
            //string tokdden=@"FoluB\/oYyXPTbFCRTrJMbwBodY4jR1RwVtGSXCtrxa4OjeIsovSI0nihqPXllAUdHTW9dNuOuaIk5Xb93dqDG6Ld6qnuRTeuXp0hpFrbwkwOataMcS2NwE9NCcgQZlH4IjdCjds7euP5kxzWjPVmWiP67YJz4zVQieQ6iJDLEIs=";

            AuthenticationUtil.Verify(token);
        }
示例#4
0
        public string Authenticate(AuthenticationInstance ai)
        {
            EventLog log = new EventLog("MyEvent");

            //  首先应判断日志来源是否存在,一个日志来源只能同时与一个事件绑定s
            if (!EventLog.SourceExists("New Application"))
            {
                EventLog.CreateEventSource("New Application", "MyEvent");
            }

            log.Source = "New Application";
            log.WriteEntry("authenticate:" + ai.UserName, EventLogEntryType.Information);
            log.WriteEntry("authenticate:" + ai.PassWord, EventLogEntryType.Information);
            Console.WriteLine(ai.UserName);
            Console.WriteLine(ai.PassWord);

            string token = AuthenticationUtil.GenCookieToken(ai);

            //AuthenticationUtil.Verify(token);
            return(token);
        }
        public FunctionPointList GetRoot()
        {
            string   token = HttpContext.Current.Request.Headers[AuthenticationUtil.Dashboard365TokenName];
            EventLog log   = new EventLog("MyEvent");

            //  首先应判断日志来源是否存在,一个日志来源只能同时与一个事件绑定s
            if (!EventLog.SourceExists("New Application"))
            {
                EventLog.CreateEventSource("New Application", "MyEvent");
            }

            log.Source = "New Application";
            log.WriteEntry("token" + token, EventLogEntryType.Information);

            if (!AuthenticationUtil.Verify(token))
            {
                return(null);
            }

            FunctionPointList l = new FunctionPointList();
            FunctionPoint     s = new FunctionPoint();

            s.Title         = "Users Management";
            s.ImgUrl        = "/staticImages/users.png";
            s.AlertCount    = "3";
            s.Description   = "Users Management Component";
            s.NavigationUrl = "/s.htm";
            l.Add(s);

            FunctionPoint s2 = new FunctionPoint();

            s2.Title         = "Users Management";
            s2.ImgUrl        = "/staticImages/users.png";
            s2.AlertCount    = "3";
            s2.Description   = "Users Management Component";
            s2.NavigationUrl = "/s.htm";
            l.Add(s2);

            return(l);
        }