Пример #1
0
        private Regex BuildRegexByLocationWithKey(SecureLocationType locationType, string secureKey)
        {
            switch (locationType)
            {
            case SecureLocationType.Rest:
                return(new Regex(@$ "(?<{KeyGroupName}>/{secureKey}/)(?<{ValueGroupName}>[^/?]*)"));

            case SecureLocationType.Query:
                return(new Regex($@"(?<{KeyGroupName}>(\?|\&){secureKey}=)(?<{ValueGroupName}>[^\&]*)"));

            default:
                throw new NotImplementedException($"SecureLocation: {locationType.ToString()}");
            }
        }
Пример #2
0
        public string ClearSecure(string url, string secureKey, SecureLocationType locationType)
        {
            var regex = BuildRegexByLocationWithKey(locationType, secureKey);

            return(regex.Replace(url, EncodeSecureData));
        }