Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SecurityPolicy    oSP    = new SecurityPolicy(Util.GetIntNumber(hdSecurityPolicyID.Value));
            SecurityPolicyDAL oSPDAL = new SecurityPolicyDAL();

            oSP.IsChangePassFirst       = ddlRequiredToChangePw.SelectedValue == "true" ? true : false;
            oSP.OldPassProhibited       = Util.GetIntNumber(txtOldPwprohibited.Text.Trim());
            oSP.MinPassLength           = Util.GetIntNumber(txtMinimumPwLg.Text.Trim());
            oSP.IsForceAlphaNumericPass = ddlAlphaNumPw.SelectedValue == "true" ? true : false;
            oSP.PassExpiresAfterDays    = Util.GetIntNumber(txtPwExpDays.Text.Trim());
            oSP.DaysEarlierPass         = Util.GetIntNumber(txtDayEarly.Text.Trim());
            oSP.MaxWrongTtrial          = Util.GetIntNumber(txtWrongLoginTrial.Text.Trim());


            oSP.UserDetails = ucUserDet.UserDetail;
            Result oResult = (Result)oSPDAL.Save(oSP);

            if (oResult.Status)
            {
                this.LoadList();
                ClearTextValue();
                hdSecurityPolicyID.Value = "";
                ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS);
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR);
            }
        }
        public void ClassSetup()
        {
            AuthenticationContext.EnterSystemContext();

            IIdentityProviderService identityProvider = ApplicationServiceContext.Current.GetService <IIdentityProviderService>();
            var identity = identityProvider.CreateIdentity(nameof(SecurityRolePersistenceServiceTest), "password", AuthenticationContext.Current.Principal);

            // Give this identity the administrative functions group
            IRoleProviderService roleProvider = ApplicationServiceContext.Current.GetService <IRoleProviderService>();

            roleProvider.AddUsersToRoles(new string[] { identity.Name }, new string[] { "ADMINISTRATORS" }, AuthenticationContext.Current.Principal);

            // Authorize
            s_authorization = identityProvider.Authenticate(nameof(SecurityRolePersistenceServiceTest), "password");


            IDataPersistenceService <SecurityPolicy> policyService = ApplicationServiceContext.Current.GetService <IDataPersistenceService <SecurityPolicy> >();

            s_chickenCostumePolicy = new SecurityPolicy()
            {
                Name = "Allow wearing of chicken costume",
                Oid  = "2.3.23.543.25.2"
            };
            s_chickenCostumePolicy = policyService.Insert(s_chickenCostumePolicy, TransactionMode.Commit, s_authorization);
        }
Пример #3
0
 public static byte[] SymmetricSign(byte[] key, ArraySegment <byte> data, SecurityPolicy policy)
 {
     using (MemoryStream memoryStream = new MemoryStream(data.Array, data.Offset, data.Count))
     {
         return(UASecurity.HMACForSecurityPolicy(key, policy).ComputeHash(memoryStream));
     }
 }
Пример #4
0
 public static byte[] SHACalculate(ArraySegment <byte> data, SecurityPolicy policy)
 {
     using (System.Security.Cryptography.HashAlgorithm hashAlgorithm = UASecurity.HashAlgorithmForSecurityPolicy(policy))
     {
         return(hashAlgorithm.ComputeHash(data.Array, data.Offset, data.Count));
     }
 }
Пример #5
0
 public static byte[] SHACalculate(byte[] data, SecurityPolicy policy)
 {
     using (System.Security.Cryptography.HashAlgorithm hashAlgorithm = UASecurity.HashAlgorithmForSecurityPolicy(policy))
     {
         return(hashAlgorithm.ComputeHash(data));
     }
 }
Пример #6
0
        public static byte[] RsaPkcs15Sha_Decrypt(
            ArraySegment <byte> data,
            X509Certificate2 cert,
            RSA rsaPrivate,
            SecurityPolicy policy)
        {
            int cipherTextBlockSize = UASecurity.GetCipherTextBlockSize(cert);

            byte[] buffer1 = new byte[data.Count / cipherTextBlockSize * UASecurity.GetPlainBlockSize(cert, UASecurity.UseOaepForSecurityPolicy(policy))];
            int    length  = rsaPrivate.KeySize / 8;

            UASecurity.GetPlainBlockSize(cert, UASecurity.UseOaepForSecurityPolicy(policy));
            if ((uint)(data.Count % length) > 0U)
            {
                throw new Exception(string.Format("Input data is not a multiple of block size, {0}/{1}", data.Count, length));
            }

            MemoryStream memoryStream = new MemoryStream(buffer1);

            byte[] data1 = new byte[length];
            for (int offset = data.Offset; offset < data.Offset + data.Count; offset += length)
            {
                Array.Copy(data.Array, offset, data1, 0, data1.Length);
                byte[] buffer2 = rsaPrivate.Decrypt(data1, UASecurity.UseOaepForSecurityPolicy(policy));
                memoryStream.Write(buffer2, 0, buffer2.Length);
            }
            memoryStream.Close();
            return(buffer1);
        }
Пример #7
0
        public static byte[] RsaPkcs15Sha_Encrypt(
            ArraySegment <byte> data,
            X509Certificate2 cert,
            SecurityPolicy policy)
        {
            RSA key            = cert.PublicKey.Key as RSA;
            int plainBlockSize = UASecurity.GetPlainBlockSize(cert, UASecurity.UseOaepForSecurityPolicy(policy));

            if ((uint)(data.Count % plainBlockSize) > 0U)
            {
                throw new Exception(string.Format("Input data is not a multiple of block size, {0}/{1}", data.Count, plainBlockSize));
            }

            byte[]       data1        = new byte[plainBlockSize];
            MemoryStream memoryStream = new MemoryStream();

            for (int index = 0; index < data.Count; index += plainBlockSize)
            {
                Array.Copy(data.Array, data.Offset + index, data1, 0, data1.Length);
                byte[] buffer = key.Encrypt(data1, UASecurity.UseOaepForSecurityPolicy(policy));
                memoryStream.Write(buffer, 0, buffer.Length);
            }
            memoryStream.Close();
            return(memoryStream.ToArray());
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            IncludeCss("OutOfStockNotification", "/Templates/" + TemplateName + "/css/GridView/tablesort.css",
                       "/Templates/" + TemplateName + "/css/MessageBox/style.css");
            IncludeJs("OutOfStockNotification", "/js/GridView/jquery.grid.js", "/js/GridView/SagePaging.js",
                      "/js/GridView/jquery.global.js", "/js/GridView/jquery.dateFormat.js",
                      "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/Modules/AspxCommerce/AspxOutOfStockNotification/js/stockNotification.js");


            StoreID     = GetStoreID;
            PortalID    = GetPortalID;
            UserName    = GetUsername;
            CultureName = GetCurrentCultureName;
            FormsAuthenticationTicket ticket = SecurityPolicy.GetUserTicket(GetPortalID);
            if (ticket != null && ticket.Name != ApplicationKeys.anonymousUser)
            {
                MembershipController member     = new MembershipController();
                UserInfo             userDetail = member.GetUserDetails(GetPortalID, GetUsername);
                userEmail = userDetail.Email;
            }
        }
        IncludeLanguageJS();
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalServicePath",
                                                " var aspxservicePath='" + ResolveUrl("~/") +
                                                "Modules/AspxCommerce/AspxCommerceServices/" + "';", true);
        lblOutofStockNotificationManage.Text = "Out of Stock Notification Management";
    }
Пример #9
0
        private void SetAdminParts()
        {
            SecurityPolicy objSecurity = new SecurityPolicy();
            HttpCookie     authCookie  = Request.Cookies[objSecurity.FormsCookieName(GetPortalID)];

            if (authCookie != null)
            {
                RoleController _role = new RoleController();
                bool           isDashboardAccessible = _role.IsDashboardAccesible(GetUsername, GetPortalID);
                if (isDashboardAccessible)
                {
                    divAdminControlPanel.Visible = true;
                    ApplicationController objAppController = new ApplicationController();
                    // objAppController.ChangeCss(Page, "pchWhole", "lytA", "sfOuterWrapper", "style", "margin-top:30px");
                }
            }
            else
            {
                divAdminControlPanel.Visible = false;
            }
            if (IsHandheld())
            {
                divAdminControlPanel.Visible = false;
            }
        }
        /// <summary>
        /// Creates a new policy in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/alpha/reference/securityPolicies/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="body">A valid Compute alpha body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, SecurityPolicy body, SecurityPoliciesInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Building the initial request.
                var request = service.SecurityPolicies.Insert(body, project);

                // Applying optional parameters to the request.
                request = (SecurityPoliciesResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request SecurityPolicies.Insert failed.", ex);
            }
        }
Пример #11
0
        public static byte[] RsaPkcs15Sha1_Encrypt(ArraySegment <byte> data, X509Certificate2 cert,
                                                   SecurityPolicy policy)
        {
            bool useOaep = policy == SecurityPolicy.Basic256;

            var padMethod = UASecurity.PaddingMethodForSecurityPolicy(policy);
            int padSize   = UASecurity.PaddingSizeForMethod(padMethod);

            var rsa             = cert.PublicKey.Key as RSA;
            int inputBlockSize  = GetPlainBlockSize(cert, useOaep);
            int outputBlockSize = rsa.KeySize / 8;

            if (data.Count % inputBlockSize != 0)
            {
                throw new Exception(string.Format("Input data is not a multiple of block size, {0}/{1}", data.Count,
                                                  inputBlockSize));
            }

            var input = new byte[inputBlockSize];
            var ms    = new MemoryStream();

            for (int i = 0; i < data.Count; i += inputBlockSize)
            {
                Array.Copy(data.Array, data.Offset + i, input, 0, input.Length);
                var encoded = rsa.Encrypt(input, useOaep ? RSAEncryptionPadding.OaepSHA1 : RSAEncryptionPadding.Pkcs1);
                ms.Write(encoded, 0, encoded.Length);
            }

            ms.Close();
            return(ms.ToArray());
        }
Пример #12
0
        public async Task <AFulfillable_Fulfillable> GetFulfillableAsync(long fulfillableId)
        {
            using var log = BeginFunction(nameof(FulfillableAdminService), nameof(GetFulfillableAsync), fulfillableId);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                var mFulfillable = await FulfillmentMicroService.GetFulfillableAsync(fulfillableId);

                var mTransactionSummaries = await FulfillmentMicroService.GetFulfillableTransactionSummariesAsync(fulfillableId, null, null);

                var mEventSummaries = await FulfillmentMicroService.GetFulfillableEventLogSummariesAsync(fulfillableId, null, null);

                var allowEdit = await SecurityPolicy.AllowEditFulfillment();

                var result = Create.AFulfillable_Fulfillable(mFulfillable, mTransactionSummaries, mEventSummaries, allowEdit);

                log.Result(result);

                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }
Пример #13
0
        public static byte[] RsaPkcs15Sha_Decrypt(ArraySegment <byte> data, X509Certificate2 cert,
                                                  RSA rsaPrivate, SecurityPolicy policy)
        {
            int cipherBlockSize = GetCipherTextBlockSize(cert);
            int plainSize       = data.Count / cipherBlockSize;
            int blockSize       = GetPlainBlockSize(cert, UseOaepForSecurityPolicy(policy));

            plainSize *= blockSize;

            var buffer          = new byte[plainSize];
            int inputBlockSize  = rsaPrivate.KeySize / 8;
            int outputBlockSize = GetPlainBlockSize(cert, UseOaepForSecurityPolicy(policy));

            if (data.Count % inputBlockSize != 0)
            {
                throw new Exception(string.Format("Input data is not a multiple of block size, {0}/{1}", data.Count, inputBlockSize));
            }

            var ms    = new MemoryStream(buffer);
            var block = new byte[inputBlockSize];

            for (int i = data.Offset; i < data.Offset + data.Count; i += inputBlockSize)
            {
                Array.Copy(data.Array, i, block, 0, block.Length);
                var plain = rsaPrivate.Decrypt(block, UseOaepForSecurityPolicy(policy));
                ms.Write(plain, 0, plain.Length);
            }
            ms.Close();

            return(buffer);
        }
Пример #14
0
        public ActivityLogModel()
        {
            SecurityPolicy policy = new SecurityPolicy();

            UserId    = new Guid(policy.UserId());
            IpAddress = IpHelper.GetPublicIPAddress();
        }
Пример #15
0
 /// <summary>Enables the validators, based on the Publish settings for this site.</summary>
 private void EnableValidators()
 {
     this.InvisibleCaptcha.Visible = this.InvisibleCaptcha.Enabled = Utility.GetBooleanPortalSetting(Utility.PublishEnableInvisibleCaptcha, this.PortalId, true);
     this.TimeoutCaptcha.Visible   = this.TimeoutCaptcha.Enabled = Utility.GetBooleanPortalSetting(Utility.PublishEnableTimedCaptcha, this.PortalId, true);
     this.StandardCaptcha.Visible  = this.StandardCaptcha.Enabled = Utility.GetBooleanPortalSetting(Utility.PublishEnableStandardCaptcha, this.PortalId, false);
     this.StandardCaptcha.CaptchaImage.EnableCaptchaAudio = SecurityPolicy.HasAspNetHostingPermission();
 }
        public static void ClassSetup(TestContext context)
        {
            AppDomain.CurrentDomain.SetData(
                "DataDirectory",
                Path.Combine(context.TestDeploymentDir, string.Empty));

            IIdentityProviderService identityProvider = ApplicationContext.Current.GetService <IIdentityProviderService>();
            var identity = identityProvider.CreateIdentity(nameof(SecurityRolePersistenceServiceTest), "password", AuthenticationContext.SystemPrincipal);

            // Give this identity the administrative functions group
            IRoleProviderService roleProvider = ApplicationContext.Current.GetService <IRoleProviderService>();

            roleProvider.AddUsersToRoles(new string[] { identity.Name }, new string[] { "ADMINISTRATORS" }, AuthenticationContext.SystemPrincipal);

            // Authorize
            s_authorization = identityProvider.Authenticate(nameof(SecurityRolePersistenceServiceTest), "password");


            IDataPersistenceService <SecurityPolicy> policyService = ApplicationContext.Current.GetService <IDataPersistenceService <SecurityPolicy> >();

            s_chickenCostumePolicy = new SecurityPolicy()
            {
                Name = "Allow wearing of chicken costume",
                Oid  = "2.3.23.543.25.2"
            };
            s_chickenCostumePolicy = policyService.Insert(s_chickenCostumePolicy, s_authorization, TransactionMode.Commit);
        }
Пример #17
0
 public static byte[] SHACalculate(byte[] data, SecurityPolicy policy)
 {
     using (var sha = HashAlgorithmForSecurityPolicy(policy))
     {
         return(sha.ComputeHash(data));
     }
 }
Пример #18
0
        private void SetPageInitPart()
        {
            ltrJQueryLibrary.Text = GetAdminJqueryLibraryPath();
            CheckUserLogin();
            string PageName = Path.GetFileNameWithoutExtension(PagePath);

            //adminImage.ImageUrl = GetUserImage;
            if (PageName != null)
            {
                SecurityPolicy objSecurity = new SecurityPolicy();

                userName        = objSecurity.GetUser(GetPortalID);
                templateFavicon = SetFavIcon(GetActiveTemplate);
                Extension       = SageFrameSettingKeys.PageExtension;
                ApplicationController objAppController = new ApplicationController();
                objSecurity.UpdateExpireTime(userName, GetPortalID);
                if (!objAppController.CheckRequestExtension(Request))
                {
                    SageInitPart();
                }
                SetGlobalVariable();
                bool IsAdmin = true;
                IncludeStartup(GetPortalID, pchHolder, IsAdmin);
            }
            else
            {
                Response.Redirect(PortalAPI.PageNotAccessibleURL);
            }
        }
Пример #19
0
    protected void lnkloginStatus_Click(object sender, EventArgs e)
    {
        SageFrameConfig SageConfig = new SageFrameConfig();

        SageFrameSettingKeys.PageExtension = SageConfig.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
        bool EnableSessionTracker = bool.Parse(SageConfig.GetSettingsByKey(SageFrameSettingKeys.EnableSessionTracker));

        if (EnableSessionTracker)
        {
            SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
            sLog.SessionLogEnd(GetPortalID);
        }
        SecurityPolicy objSecurity        = new SecurityPolicy();
        HttpCookie     authenticateCookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID));

        authenticateCookie.Expires = DateTime.Now.AddYears(-1);
        string randomCookieValue = GenerateRandomCookieValue();

        HttpContext.Current.Session[SessionKeys.RandomCookieValue] = randomCookieValue;
        Response.Cookies.Add(authenticateCookie);
        SetUserRoles(string.Empty);
        HttpContext.Current.Session[SessionKeys.ModuleCss] = new List <CssScriptInfo>();
        HttpContext.Current.Session[SessionKeys.ModuleJs]  = new List <CssScriptInfo>();
        Response.Redirect(GetHostURL() + "/" + tempPageName.Replace(" ", "-"));
    }
Пример #20
0
 public static byte[] SHACalculate(ArraySegment <byte> data, SecurityPolicy policy)
 {
     using (var sha = HashAlgorithmForSecurityPolicy(policy))
     {
         return(sha.ComputeHash(data.Array, data.Offset, data.Count));
     }
 }
Пример #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //IncludeCss("UserProfile", "/js/jquery-ui-1.8.14.custom/css/redmond/jquery-ui-1.8.16.custom.css");
        SecurityPolicy            objSecurity = new SecurityPolicy();
        FormsAuthenticationTicket ticket      = objSecurity.GetUserTicket(GetPortalID);

        if (ticket.Name != ApplicationKeys.anonymousUser)
        {
            int LoggedInPortalID = int.Parse(ticket.UserData.ToString());
        }
        else
        {
            RedirectToInvalid();
        }
        IncludeJs("UserManagementValidation", "/js/jquery.validate.js");
        tblEditProfile.Visible = false;
        tblViewProfile.Visible = true;
        divSaveProfile.Visible = false;
        sfUserProfile.Visible  = false;
        divUserInfo.Visible    = true;
        if (!IsPostBack)
        {
            LoadUserDetails();
        }
    }
        public void GetRequestObject()
        {
            moq::Mock <SecurityPolicies.SecurityPoliciesClient> mockGrpcClient = new moq::Mock <SecurityPolicies.SecurityPoliciesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetSecurityPolicyRequest request = new GetSecurityPolicyRequest
            {
                SecurityPolicy = "security_policy76596315",
                Project        = "projectaa6ff846",
            };
            SecurityPolicy expectedResponse = new SecurityPolicy
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                Rules             =
                {
                    new SecurityPolicyRule(),
                },
                AdaptiveProtectionConfig = new SecurityPolicyAdaptiveProtectionConfig(),
                Fingerprint           = "fingerprint009e6052",
                Description           = "description2cf9da67",
                AdvancedOptionsConfig = new SecurityPolicyAdvancedOptionsConfig(),
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SecurityPoliciesClient client   = new SecurityPoliciesClientImpl(mockGrpcClient.Object, null);
            SecurityPolicy         response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #23
0
    public void CheckAccess()
    {
        string          preFix       = string.Empty;
        string          paneName     = string.Empty;
        string          ControlSrc   = string.Empty;
        string          phdContainer = string.Empty;
        string          PageSEOName  = string.Empty;
        string          redirecPath  = string.Empty;
        SageFrameConfig sfConfig     = new SageFrameConfig();

        IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
        StoreAccessDetailsInfo storeAccessTracker = new StoreAccessDetailsInfo();

        storeAccessTracker.PortalID = GetPortalID;
        storeAccessTracker.StoreID  = GetStoreID;
        storeAccessTracker.Username = GetUsername;
        SecurityPolicy            objSecurity = new SecurityPolicy();
        FormsAuthenticationTicket ticket      = objSecurity.GetUserTicket(GetPortalID);
        StoreAccessResultInfo     saResults   = (StoreAccessResultInfo)GetStoreAccessByCurrentData(storeAccessTracker);
        bool storeClosed     = (bool)saResults.StoreClosed;
        bool storeAccessible = (bool)saResults.IsAccess;

        if (storeAccessible)
        {
            string returnURL = HttpContext.Current.Session["StoreClosed"].ToString();
            HttpContext.Current.Session.Remove("StoreClosed");
            Response.Redirect(returnURL);
        }
        else
        {
        }
    }
Пример #24
0
        public static byte[] PSHA(byte[] secret, byte[] seed, int length, SecurityPolicy policy)
        {
            var hmac    = HMACForSecurityPolicy(secret, policy);
            int sigSize = SignatureSizeForSecurityPolicy(policy);

            var tmp     = hmac.ComputeHash(seed);
            var keySeed = new byte[sigSize + seed.Length];

            Array.Copy(tmp, keySeed, tmp.Length);
            Array.Copy(seed, 0, keySeed, tmp.Length, seed.Length);

            var output = new byte[length];

            int pos = 0;

            while (pos < length)
            {
                byte[] hash = hmac.ComputeHash(keySeed);

                int writeLen = Math.Min(sigSize, length - pos);
                Array.Copy(hash, 0, output, pos, writeLen);
                pos += writeLen;

                tmp = hmac.ComputeHash(tmp);
                Array.Copy(tmp, keySeed, tmp.Length);
            }

            return(output);
        }
        private void SetPageInitPart()
        {
            ltrJQueryLibrary.Text = GetJqueryLibraryPath();
            CheckUserLogin();
            string PageName = "EditPages";// Path.GetFileNameWithoutExtension(PagePath);

            if (PageName != null)
            {
                SecurityPolicy objSecurity = new SecurityPolicy();
                userName        = objSecurity.GetUser(1);
                templateFavicon = SetFavIcon(GetActiveTemplate);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "templatefavicon", " var templateFavIcon='" + templateFavicon + "';", true);
                Extension = SageFrameSettingKeys.PageExtension;
                ApplicationController objAppController = new ApplicationController();
                objSecurity.UpdateExpireTime(userName, 1);
                if (!objAppController.CheckRequestExtension(Request))
                {
                    SageInitPart();
                }
                SetGlobalVariable();
                bool IsAdmin = true;
                IncludeStartup(1, pchHolder, IsAdmin);
            }
            else
            {
                Response.Redirect(PortalAPI.PageNotAccessibleURL);
            }
        }
Пример #26
0
		internal Session CreateSession(string sessionName, string serverUrl, MessageSecurityMode securityMode, SecurityPolicy securityPolicy, MessageEncoding messageEncoding, UserIdentity userId)
		{
			Session session = new Session(serverUrl, securityMode, securityPolicy.ToString(), messageEncoding, userId, null);
			session.SessionName = sessionName;
			session.Connect(false, true);
			return session;
		}
Пример #27
0
        private void SetAdminParts()
        {
            SecurityPolicy objSecurity = new SecurityPolicy();
            HttpCookie     authCookie  = Request.Cookies[objSecurity.FormsCookieName(GetPortalID)];

            if (authCookie != null)
            {
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
                string user = ticket.Name;
                if (user != string.Empty && user != ApplicationKeys.anonymousUser)
                {
                    divAdminControlPanel.Visible = true;
                    ApplicationController objAppController = new ApplicationController();
                    // objAppController.ChangeCss(Page, "pchWhole", "lytA", "sfOuterWrapper", "style", "margin-top:30px");
                }
            }
            else
            {
                divAdminControlPanel.Visible = false;
            }
            if (IsHandheld())
            {
                divAdminControlPanel.Visible = false;
            }
        }
Пример #28
0
 /// <summary>
 /// Constructs this policy information object from an IMS policy instane
 /// </summary>
 public SecurityPolicyInfo(SecurityPolicy o)
 {
     this.Name        = o.Name;
     this.Oid         = o.Oid;
     this.CanOverride = o.CanOverride;
     this.Policy      = o;
 }
Пример #29
0
        private void LogInPublicModeRegistration()
        {
            string strRoles             = string.Empty;
            MembershipController member = new MembershipController();
            RoleController       role   = new RoleController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text.Trim());

            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        sessionTracker.PortalID      = GetPortalID.ToString();
                        sessionTracker.Username      = UserName.Text;
                        Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                        {
                            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                             user.UserName,
                                                                                             DateTime.Now,
                                                                                             DateTime.Now.AddMinutes(30),
                                                                                             true,
                                                                                             GetPortalID.ToString(),
                                                                                             FormsAuthentication.FormsCookiePath);

                            // Encrypt the ticket.
                            string encTicket = FormsAuthentication.Encrypt(ticket);

                            // Create the cookie.
                            string randomCookieValue = GenerateRandomCookieValue();
                            Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                            SecurityPolicy  objSecurity            = new SecurityPolicy();
                            HttpCookie      cookie                 = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                            SageFrameConfig objConfig              = new SageFrameConfig();
                            string          ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                            int             expiryTime             = Math.Abs(int.Parse(ServerCookieExpiration));
                            expiryTime     = expiryTime < 5 ? 5 : expiryTime;
                            cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                            Response.Cookies.Add(cookie);

                            if (!IsParent)
                            {
                                Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                        }
                    }
                }
            }
        }
Пример #30
0
 public NodeConfig() {
   EdgeListeners = new EdgeListener[0];
   RemoteTAs = new String[0];
   DevicesToBind = new String[0];
   XmlRpcManager = new Service();
   NCService = new NCServiceConfig();
   Security = new SecurityPolicy();
 }
Пример #31
0
 public virtual bool SessionActivateClient(
     object session,
     SecurityPolicy securityPolicy,
     MessageSecurityMode messageSecurityMode,
     X509Certificate2 remoteCertificate)
 {
     return(true);
 }
Пример #32
0
        public Policy(SecurityPolicy policy)
        {
            this.InitializeComponent();

            this.labelName.Content = policy.Name;

            this.Background = new SolidColorBrush(UiHelpers.GetPolicyColor(policy));
        }
Пример #33
0
 public NodeConfig() {
   EdgeListeners = new EdgeListener[0];
   RemoteTAs = new String[0];
   DevicesToBind = new String[0];
   XmlRpcManager = new Service();
   NCService = new NCServiceConfig();
   Security = new SecurityPolicy();
   PrivateNodeConfig = new PrivateNodeConfig();
   BrunetNamespace = String.Empty;
   XmppServices = new XmppConfig();
 }