[Back]
// // DotNetNuke - http://www.dotnetnuke.com // Copyright (c) 2002-2009 // by DotNetNuke Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and // to permit persons to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or substantial portions // of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // using System.Web.Services.Protocols; using System.Diagnostics; using System.Reflection; using DotNetNuke.Services.Personalization; using DotNetNuke.Security; using DotNetNuke.Security.Membership; using System.Data; using System.Configuration; using System; using System.EnterpriseServices; using System.Drawing; using System.ServiceModel; using System.Runtime.Serialization; using System.Web; using System.Xml; using System.Web.Services; using System.Web.Mobile; using System.IdentityModel; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using DotNetNuke.Entities.Users; namespace DotNetNuke.Modules.DNNSilverlightChat { // class that is passed in through the soap header public class IWebXAMLAuthendicationHeader { public int PortalID; public int UserID; public string Password; public string Username; public int ModuleId; } public class IWebXAMLAuthendication { // const values private class Consts { public const string LoginErrorMessage = "Login failed. Invalid credentials supplied to the web service method."; } private int _PortalID; private int _UserID; private string _Password; private string _Username; private int _ModuleId; #region Constructors public IWebXAMLAuthendication(IWebXAMLAuthendicationHeader IWebCredentials) { _PortalID = IWebCredentials.PortalID; _ModuleId = IWebCredentials.ModuleId; _UserID = IWebCredentials.UserID; _Password = IWebCredentials.Password; } #endregion public bool IsUserValid() { UserLoginStatus objloginStatus = new UserLoginStatus(); string strEncryptionKey; // Get the Key from Personalization PersonalizationController PersonalizationController = new PersonalizationController(); PersonalizationInfo PersonalizationInfo = new PersonalizationInfo(); PersonalizationInfo = PersonalizationController.LoadProfile(_UserID, _PortalID); if (!(Personalization.GetProfile(PersonalizationInfo, _ModuleId.ToString(), "SilverlightKey") == null)) { if (((DateTime)(Personalization.GetProfile(PersonalizationInfo, _ModuleId.ToString(), "SilverlightKey_Expires"))) < DateTime.Now) { // Expired Encryption Key return false; } strEncryptionKey = ((string)(Personalization.GetProfile(PersonalizationInfo, _ModuleId.ToString(), "SilverlightKey"))); if (_Password == strEncryptionKey) { UserInfo SilverlightUser = new UserInfo(); SilverlightUser = UserController.GetUser(_PortalID, _UserID, false); _Password = UserController.GetPassword(ref SilverlightUser, "").ToString(); _Username = SilverlightUser.Username; } else { return false; } } UserInfo objUser = UserController.ValidateUser(_PortalID, _Username, _Password, "", "", "255.255.255.1", ref objloginStatus); if (objUser == null) { return false; } else { return true; } } public UserInfo GetUserInfo() { UserLoginStatus objloginStatus = new UserLoginStatus(); return UserController.ValidateUser(_PortalID, _Username, _Password, "", "", "255.255.255.1", ref objloginStatus); } } }