示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationModule"/> class.
        /// </summary>
        /// <param name="webServiceAuthentication">
        /// The web Service Authentication.
        /// </param>
        public AuthenticationModule(ICDP4WebServiceAuthentication webServiceAuthentication)
        {
            this.Get["/login"] = _ =>
            {
                if (this.Context.CurrentUser == null)
                {
                    return(HttpStatusCode.Unauthorized);
                }

                // Identify user's location and save this data
                this.ContributorLocationResolver.GetLocationDataAndSave();

                return(HttpStatusCode.Accepted);
            };

            this.Get["/logout"] = _ =>
            {
                return(webServiceAuthentication.LogOutResponse(this.Context));
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationModule"/> class.
        /// </summary>
        /// <param name="webServiceAuthentication">
        /// The web Service Authentication.
        /// </param>
        public AuthenticationModule(ICDP4WebServiceAuthentication webServiceAuthentication)
        {
            this.Get["/login"] = _ =>
            {
                if (this.Context.CurrentUser == null)
                {
                    return(HttpStatusCode.Unauthorized);
                }

                // Identify user's location and save this data
                // TODO (ticket T3809)revise geo ip service, it does not work properly, that is why it is commented
                // this.ContributorLocationResolver.GetLocationDataAndSave();

                return(HttpStatusCode.Accepted);
            };

            this.Get["/logout"] = _ =>
            {
                return(webServiceAuthentication.LogOutResponse(this.Context));
            };
        }