Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

NopSecurityDefaults.cs

using Nop.Core.Caching;
using Nop.Core.Domain.Security;

namespace Nop.Services.Security;

/// 
/// Represents default values related to security services
/// 
public static partial class NopSecurityDefaults
{
    #region reCAPTCHA

    /// 
    /// Gets a reCAPTCHA script URL
    /// 
    /// 
    /// {0} : Id of recaptcha instance on page
    /// {1} : Render type
    /// {2} : language if exists
    /// 
    public static string RecaptchaScriptPath => "api.js?onload=onloadCallback{0}&render={1}{2}";

    /// 
    /// Gets a reCAPTCHA validation URL
    /// 
    /// 
    /// {0} : private key
    /// {1} : response value
    /// {2} : IP address
    /// 
    public static string RecaptchaValidationPath => "api/siteverify?secret={0}&response={1}&remoteip={2}";

    #endregion

    #region Caching defaults

    #region Access control list

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : entity ID
    /// {1} : entity name
    /// 
    public static CacheKey AclRecordCacheKey => new("Nop.aclrecord.{0}-{1}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : entity name
    /// 
    public static CacheKey EntityAclRecordExistsCacheKey => new("Nop.aclrecord.exists.{0}");

    #endregion

    #region Permissions

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : permission system name
    /// {1} : customer role ID
    /// 
    public static CacheKey PermissionAllowedCacheKey => new("Nop.permissionrecord.allowed.{0}-{1}", PermissionAllowedPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : permission system name
    /// 
    public static string PermissionAllowedPrefix => "Nop.permissionrecord.allowed.{0}";

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : customer role ID
    /// 
    public static CacheKey PermissionRecordsAllCacheKey => new("Nop.permissionrecord.all.{0}", NopEntityCacheDefaults.AllPrefix);

    #endregion

    #endregion
}