Fix invalid escape sequence \. in regular expression \\.
This commit is contained in:
parent
248658b52d
commit
a6cf8aaa20
@ -23,6 +23,7 @@ Fixes
|
|||||||
isFromNewLogin from service validation response
|
isFromNewLogin from service validation response
|
||||||
* Catch error from calling django.contrib.staticfiles.templatetags.staticfiles.static
|
* Catch error from calling django.contrib.staticfiles.templatetags.staticfiles.static
|
||||||
in non-debug mode before collectstatic in cas_server.default_settings.py
|
in non-debug mode before collectstatic in cas_server.default_settings.py
|
||||||
|
* Invalid escape sequence in regular expression
|
||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
@ -30,7 +30,7 @@ class BaseServicePattern(object):
|
|||||||
cls.service = "https://www.example.com"
|
cls.service = "https://www.example.com"
|
||||||
cls.service_pattern = models.ServicePattern.objects.create(
|
cls.service_pattern = models.ServicePattern.objects.create(
|
||||||
name="example",
|
name="example",
|
||||||
pattern="^https://www\.example\.com(/.*)?$",
|
pattern=r"^https://www\.example\.com(/.*)?$",
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
models.ReplaceAttributName.objects.create(name="*", service_pattern=cls.service_pattern)
|
models.ReplaceAttributName.objects.create(name="*", service_pattern=cls.service_pattern)
|
||||||
@ -39,14 +39,14 @@ class BaseServicePattern(object):
|
|||||||
cls.service_restrict_user_fail = "https://restrict_user_fail.example.com"
|
cls.service_restrict_user_fail = "https://restrict_user_fail.example.com"
|
||||||
cls.service_pattern_restrict_user_fail = models.ServicePattern.objects.create(
|
cls.service_pattern_restrict_user_fail = models.ServicePattern.objects.create(
|
||||||
name="restrict_user_fail",
|
name="restrict_user_fail",
|
||||||
pattern="^https://restrict_user_fail\.example\.com(/.*)?$",
|
pattern=r"^https://restrict_user_fail\.example\.com(/.*)?$",
|
||||||
restrict_users=True,
|
restrict_users=True,
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
cls.service_restrict_user_success = "https://restrict_user_success.example.com"
|
cls.service_restrict_user_success = "https://restrict_user_success.example.com"
|
||||||
cls.service_pattern_restrict_user_success = models.ServicePattern.objects.create(
|
cls.service_pattern_restrict_user_success = models.ServicePattern.objects.create(
|
||||||
name="restrict_user_success",
|
name="restrict_user_success",
|
||||||
pattern="^https://restrict_user_success\.example\.com(/.*)?$",
|
pattern=r"^https://restrict_user_success\.example\.com(/.*)?$",
|
||||||
restrict_users=True,
|
restrict_users=True,
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
@ -59,7 +59,7 @@ class BaseServicePattern(object):
|
|||||||
cls.service_filter_fail = "https://filter_fail.example.com"
|
cls.service_filter_fail = "https://filter_fail.example.com"
|
||||||
cls.service_pattern_filter_fail = models.ServicePattern.objects.create(
|
cls.service_pattern_filter_fail = models.ServicePattern.objects.create(
|
||||||
name="filter_fail",
|
name="filter_fail",
|
||||||
pattern="^https://filter_fail\.example\.com(/.*)?$",
|
pattern=r"^https://filter_fail\.example\.com(/.*)?$",
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
models.FilterAttributValue.objects.create(
|
models.FilterAttributValue.objects.create(
|
||||||
@ -70,7 +70,7 @@ class BaseServicePattern(object):
|
|||||||
cls.service_filter_fail_alt = "https://filter_fail_alt.example.com"
|
cls.service_filter_fail_alt = "https://filter_fail_alt.example.com"
|
||||||
cls.service_pattern_filter_fail_alt = models.ServicePattern.objects.create(
|
cls.service_pattern_filter_fail_alt = models.ServicePattern.objects.create(
|
||||||
name="filter_fail_alt",
|
name="filter_fail_alt",
|
||||||
pattern="^https://filter_fail_alt\.example\.com(/.*)?$",
|
pattern=r"^https://filter_fail_alt\.example\.com(/.*)?$",
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
models.FilterAttributValue.objects.create(
|
models.FilterAttributValue.objects.create(
|
||||||
@ -81,7 +81,7 @@ class BaseServicePattern(object):
|
|||||||
cls.service_filter_success = "https://filter_success.example.com"
|
cls.service_filter_success = "https://filter_success.example.com"
|
||||||
cls.service_pattern_filter_success = models.ServicePattern.objects.create(
|
cls.service_pattern_filter_success = models.ServicePattern.objects.create(
|
||||||
name="filter_success",
|
name="filter_success",
|
||||||
pattern="^https://filter_success\.example\.com(/.*)?$",
|
pattern=r"^https://filter_success\.example\.com(/.*)?$",
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
models.FilterAttributValue.objects.create(
|
models.FilterAttributValue.objects.create(
|
||||||
@ -94,21 +94,21 @@ class BaseServicePattern(object):
|
|||||||
cls.service_field_needed_fail = "https://field_needed_fail.example.com"
|
cls.service_field_needed_fail = "https://field_needed_fail.example.com"
|
||||||
cls.service_pattern_field_needed_fail = models.ServicePattern.objects.create(
|
cls.service_pattern_field_needed_fail = models.ServicePattern.objects.create(
|
||||||
name="field_needed_fail",
|
name="field_needed_fail",
|
||||||
pattern="^https://field_needed_fail\.example\.com(/.*)?$",
|
pattern=r"^https://field_needed_fail\.example\.com(/.*)?$",
|
||||||
user_field="uid",
|
user_field="uid",
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
cls.service_field_needed_success = "https://field_needed_success.example.com"
|
cls.service_field_needed_success = "https://field_needed_success.example.com"
|
||||||
cls.service_pattern_field_needed_success = models.ServicePattern.objects.create(
|
cls.service_pattern_field_needed_success = models.ServicePattern.objects.create(
|
||||||
name="field_needed_success",
|
name="field_needed_success",
|
||||||
pattern="^https://field_needed_success\.example\.com(/.*)?$",
|
pattern=r"^https://field_needed_success\.example\.com(/.*)?$",
|
||||||
user_field="alias",
|
user_field="alias",
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
cls.service_field_needed_success_alt = "https://field_needed_success_alt.example.com"
|
cls.service_field_needed_success_alt = "https://field_needed_success_alt.example.com"
|
||||||
cls.service_pattern_field_needed_success = models.ServicePattern.objects.create(
|
cls.service_pattern_field_needed_success = models.ServicePattern.objects.create(
|
||||||
name="field_needed_success_alt",
|
name="field_needed_success_alt",
|
||||||
pattern="^https://field_needed_success_alt\.example\.com(/.*)?$",
|
pattern=r"^https://field_needed_success_alt\.example\.com(/.*)?$",
|
||||||
user_field="nom",
|
user_field="nom",
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
)
|
)
|
||||||
|
@ -140,7 +140,7 @@ class UserTestCase(TestCase, UserModels):
|
|||||||
self.service = 'http://127.0.0.1:45678'
|
self.service = 'http://127.0.0.1:45678'
|
||||||
self.service_pattern = models.ServicePattern.objects.create(
|
self.service_pattern = models.ServicePattern.objects.create(
|
||||||
name="localhost",
|
name="localhost",
|
||||||
pattern="^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
pattern=r"^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
||||||
single_log_out=True
|
single_log_out=True
|
||||||
)
|
)
|
||||||
models.ReplaceAttributName.objects.create(name="*", service_pattern=self.service_pattern)
|
models.ReplaceAttributName.objects.create(name="*", service_pattern=self.service_pattern)
|
||||||
@ -241,7 +241,7 @@ class TicketTestCase(TestCase, UserModels, BaseServicePattern):
|
|||||||
self.service = 'http://127.0.0.1:45678'
|
self.service = 'http://127.0.0.1:45678'
|
||||||
self.service_pattern = models.ServicePattern.objects.create(
|
self.service_pattern = models.ServicePattern.objects.create(
|
||||||
name="localhost",
|
name="localhost",
|
||||||
pattern="^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
pattern=r"^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
||||||
single_log_out=True
|
single_log_out=True
|
||||||
)
|
)
|
||||||
models.ReplaceAttributName.objects.create(name="*", service_pattern=self.service_pattern)
|
models.ReplaceAttributName.objects.create(name="*", service_pattern=self.service_pattern)
|
||||||
|
@ -710,7 +710,7 @@ class LogoutTestCase(TestCase):
|
|||||||
self.service = 'http://127.0.0.1:45678'
|
self.service = 'http://127.0.0.1:45678'
|
||||||
self.service_pattern = models.ServicePattern.objects.create(
|
self.service_pattern = models.ServicePattern.objects.create(
|
||||||
name="localhost",
|
name="localhost",
|
||||||
pattern="^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
pattern=r"^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
||||||
single_log_out=True
|
single_log_out=True
|
||||||
)
|
)
|
||||||
# return all user attributes
|
# return all user attributes
|
||||||
@ -984,7 +984,7 @@ class AuthTestCase(TestCase):
|
|||||||
self.service = 'https://www.example.com'
|
self.service = 'https://www.example.com'
|
||||||
models.ServicePattern.objects.create(
|
models.ServicePattern.objects.create(
|
||||||
name="example",
|
name="example",
|
||||||
pattern="^https://www\.example\.com(/.*)?$"
|
pattern=r"^https://www\.example\.com(/.*)?$"
|
||||||
)
|
)
|
||||||
|
|
||||||
@override_settings(CAS_AUTH_SHARED_SECRET='test')
|
@override_settings(CAS_AUTH_SHARED_SECRET='test')
|
||||||
@ -1120,7 +1120,7 @@ class ValidateTestCase(TestCase):
|
|||||||
self.service = 'https://www.example.com'
|
self.service = 'https://www.example.com'
|
||||||
self.service_pattern = models.ServicePattern.objects.create(
|
self.service_pattern = models.ServicePattern.objects.create(
|
||||||
name="example",
|
name="example",
|
||||||
pattern="^https://www\.example\.com(/.*)?$"
|
pattern=r"^https://www\.example\.com(/.*)?$"
|
||||||
)
|
)
|
||||||
models.ReplaceAttributName.objects.create(name="*", service_pattern=self.service_pattern)
|
models.ReplaceAttributName.objects.create(name="*", service_pattern=self.service_pattern)
|
||||||
# setting up a test service and pattern using a multi valued user attribut as username
|
# setting up a test service and pattern using a multi valued user attribut as username
|
||||||
@ -1128,14 +1128,14 @@ class ValidateTestCase(TestCase):
|
|||||||
self.service_user_field = "https://user_field.example.com"
|
self.service_user_field = "https://user_field.example.com"
|
||||||
self.service_pattern_user_field = models.ServicePattern.objects.create(
|
self.service_pattern_user_field = models.ServicePattern.objects.create(
|
||||||
name="user field",
|
name="user field",
|
||||||
pattern="^https://user_field\.example\.com(/.*)?$",
|
pattern=r"^https://user_field\.example\.com(/.*)?$",
|
||||||
user_field="alias"
|
user_field="alias"
|
||||||
)
|
)
|
||||||
# setting up a test service and pattern using a single valued user attribut as username
|
# setting up a test service and pattern using a single valued user attribut as username
|
||||||
self.service_user_field_alt = "https://user_field_alt.example.com"
|
self.service_user_field_alt = "https://user_field_alt.example.com"
|
||||||
self.service_pattern_user_field_alt = models.ServicePattern.objects.create(
|
self.service_pattern_user_field_alt = models.ServicePattern.objects.create(
|
||||||
name="user field alt",
|
name="user field alt",
|
||||||
pattern="^https://user_field_alt\.example\.com(/.*)?$",
|
pattern=r"^https://user_field_alt\.example\.com(/.*)?$",
|
||||||
user_field="nom"
|
user_field="nom"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1272,7 +1272,7 @@ class ValidateServiceTestCase(TestCase, XmlContent):
|
|||||||
self.service = 'http://127.0.0.1:45678'
|
self.service = 'http://127.0.0.1:45678'
|
||||||
self.service_pattern = models.ServicePattern.objects.create(
|
self.service_pattern = models.ServicePattern.objects.create(
|
||||||
name="localhost",
|
name="localhost",
|
||||||
pattern="^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
pattern=r"^https?://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
||||||
# allow to request PGT by the service
|
# allow to request PGT by the service
|
||||||
proxy_callback=True,
|
proxy_callback=True,
|
||||||
# allow to request PT for the service
|
# allow to request PT for the service
|
||||||
@ -1285,14 +1285,14 @@ class ValidateServiceTestCase(TestCase, XmlContent):
|
|||||||
self.service_user_field = "https://user_field.example.com"
|
self.service_user_field = "https://user_field.example.com"
|
||||||
self.service_pattern_user_field = models.ServicePattern.objects.create(
|
self.service_pattern_user_field = models.ServicePattern.objects.create(
|
||||||
name="user field",
|
name="user field",
|
||||||
pattern="^https://user_field\.example\.com(/.*)?$",
|
pattern=r"^https://user_field\.example\.com(/.*)?$",
|
||||||
user_field="alias"
|
user_field="alias"
|
||||||
)
|
)
|
||||||
# test service pattern using the attribute nom as username
|
# test service pattern using the attribute nom as username
|
||||||
self.service_user_field_alt = "https://user_field_alt.example.com"
|
self.service_user_field_alt = "https://user_field_alt.example.com"
|
||||||
self.service_pattern_user_field_alt = models.ServicePattern.objects.create(
|
self.service_pattern_user_field_alt = models.ServicePattern.objects.create(
|
||||||
name="user field alt",
|
name="user field alt",
|
||||||
pattern="^https://user_field_alt\.example\.com(/.*)?$",
|
pattern=r"^https://user_field_alt\.example\.com(/.*)?$",
|
||||||
user_field="nom"
|
user_field="nom"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1300,7 +1300,7 @@ class ValidateServiceTestCase(TestCase, XmlContent):
|
|||||||
self.service_one_attribute = "https://one_attribute.example.com"
|
self.service_one_attribute = "https://one_attribute.example.com"
|
||||||
self.service_pattern_one_attribute = models.ServicePattern.objects.create(
|
self.service_pattern_one_attribute = models.ServicePattern.objects.create(
|
||||||
name="one_attribute",
|
name="one_attribute",
|
||||||
pattern="^https://one_attribute\.example\.com(/.*)?$"
|
pattern=r"^https://one_attribute\.example\.com(/.*)?$"
|
||||||
)
|
)
|
||||||
models.ReplaceAttributName.objects.create(
|
models.ReplaceAttributName.objects.create(
|
||||||
name="nom",
|
name="nom",
|
||||||
@ -1311,7 +1311,7 @@ class ValidateServiceTestCase(TestCase, XmlContent):
|
|||||||
self.service_replace_attribute_list = "https://replace_attribute_list.example.com"
|
self.service_replace_attribute_list = "https://replace_attribute_list.example.com"
|
||||||
self.service_pattern_replace_attribute_list = models.ServicePattern.objects.create(
|
self.service_pattern_replace_attribute_list = models.ServicePattern.objects.create(
|
||||||
name="replace_attribute_list",
|
name="replace_attribute_list",
|
||||||
pattern="^https://replace_attribute_list\.example\.com(/.*)?$",
|
pattern=r"^https://replace_attribute_list\.example\.com(/.*)?$",
|
||||||
)
|
)
|
||||||
models.ReplaceAttributValue.objects.create(
|
models.ReplaceAttributValue.objects.create(
|
||||||
attribut="alias",
|
attribut="alias",
|
||||||
@ -1327,7 +1327,7 @@ class ValidateServiceTestCase(TestCase, XmlContent):
|
|||||||
self.service_replace_attribute = "https://replace_attribute.example.com"
|
self.service_replace_attribute = "https://replace_attribute.example.com"
|
||||||
self.service_pattern_replace_attribute = models.ServicePattern.objects.create(
|
self.service_pattern_replace_attribute = models.ServicePattern.objects.create(
|
||||||
name="replace_attribute",
|
name="replace_attribute",
|
||||||
pattern="^https://replace_attribute\.example\.com(/.*)?$",
|
pattern=r"^https://replace_attribute\.example\.com(/.*)?$",
|
||||||
)
|
)
|
||||||
models.ReplaceAttributValue.objects.create(
|
models.ReplaceAttributValue.objects.create(
|
||||||
attribut="nom",
|
attribut="nom",
|
||||||
@ -1683,7 +1683,7 @@ class ProxyTestCase(TestCase, BaseServicePattern, XmlContent):
|
|||||||
self.service = 'http://127.0.0.1'
|
self.service = 'http://127.0.0.1'
|
||||||
self.service_pattern = models.ServicePattern.objects.create(
|
self.service_pattern = models.ServicePattern.objects.create(
|
||||||
name="localhost",
|
name="localhost",
|
||||||
pattern="^http://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
pattern=r"^http://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
||||||
proxy=True,
|
proxy=True,
|
||||||
proxy_callback=True
|
proxy_callback=True
|
||||||
)
|
)
|
||||||
@ -1857,7 +1857,7 @@ class SamlValidateTestCase(TestCase, BaseServicePattern, XmlContent):
|
|||||||
self.service_pgt = 'http://127.0.0.1'
|
self.service_pgt = 'http://127.0.0.1'
|
||||||
self.service_pattern_pgt = models.ServicePattern.objects.create(
|
self.service_pattern_pgt = models.ServicePattern.objects.create(
|
||||||
name="localhost",
|
name="localhost",
|
||||||
pattern="^http://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
pattern=r"^http://127\.0\.0\.1(:[0-9]+)?(/.*)?$",
|
||||||
proxy=True,
|
proxy=True,
|
||||||
proxy_callback=True
|
proxy_callback=True
|
||||||
)
|
)
|
||||||
|
@ -1160,7 +1160,7 @@ class ValidateService(View):
|
|||||||
# if pgtUrl is set, require https or localhost
|
# if pgtUrl is set, require https or localhost
|
||||||
if self.pgt_url and (
|
if self.pgt_url and (
|
||||||
self.pgt_url.startswith("https://") or
|
self.pgt_url.startswith("https://") or
|
||||||
re.match("^http://(127\.0\.0\.1|localhost)(:[0-9]+)?(/.*)?$", self.pgt_url)
|
re.match(r"^http://(127\.0\.0\.1|localhost)(:[0-9]+)?(/.*)?$", self.pgt_url)
|
||||||
):
|
):
|
||||||
return self.process_pgturl(params)
|
return self.process_pgturl(params)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user