示例#1
0
        public static AuthenticationData GetAuthenticationDataAndCulture(HttpContext suppliedContext)
        {
            // This function is called from all the V5 base classes to have a common
            // authentication point for every derived master, page, and control.

            // This function is also called from static page methods in AJAX calls to get
            // the current set of authentication data. Static page methods cannot access
            // the instance data of PageV5Base.

            AuthenticationData result =
                AuthenticationData.FromAuthority(Authority.FromEncryptedXml(suppliedContext.User.Identity.Name));

            CulturePreInit(HttpContext.Current.Request);

            return(result);
        }
示例#2
0
        protected override void OnOpen()
        {
            string authBase64 = Context.QueryString["Auth"];

            authBase64 = Uri.UnescapeDataString(authBase64);  // Defensive programming - % sign does not exist in base64 so this won't ever collapse a working encoding

            _authority = Authority.FromEncryptedXml(authBase64);

            Console.WriteLine(" * FWN-Internal: " + _authority.Person.Name + " connected to socket");

            base.OnOpen();

            if (Context.QueryString["Notify"] != "false")
            {
                Sessions.Broadcast("{\"messageType\":\"EditorCount\"," +
                                   String.Format("\"editorCount\":\"{0}\"", Sessions.ActiveIDs.ToArray().Length) + '}');
                Send(Program.GetQueueInfoJson());
            }
        }
示例#3
0
        protected override void OnOpen()
        {
            Console.WriteLine(" * Attempted socket connection");

            string authBase64 = Context.QueryString["Auth"];

            authBase64 = Uri.UnescapeDataString(authBase64);  // Defensive programming - % sign does not exist in base64 so this won't ever collapse a working encoding

            if (Authority.IsSystemAuthorityTokenValid(authBase64))
            {
                _authority = null; // System authority
                Console.WriteLine(" - - valid system authentication token");
            }
            else
            {
                _authority = Authority.FromEncryptedXml(authBase64);
                this.Sessions.RegisterSession(this, this._authority); // Only register non-system sessions
                Console.WriteLine(" - - authenticated: " + this._authority.Person.Canonical);
            }

            base.OnOpen();
        }