summaryrefslogtreecommitdiffstats
path: root/ipsilon/providers/saml2/admin.py
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-04-14 16:27:52 -0400
committerSimo Sorce <simo@redhat.com>2014-04-14 16:28:03 -0400
commitcc160379676d2cdede9339d169b10976613ebbbf (patch)
tree40bda7b7b1d225c3e3c30fcf29ce89f59894e1d2 /ipsilon/providers/saml2/admin.py
parent01bfc020dd2135069c7b8560a94ecf8cd7f72df8 (diff)
downloadipsilon-cc160379676d2cdede9339d169b10976613ebbbf.tar.gz
ipsilon-cc160379676d2cdede9339d169b10976613ebbbf.tar.xz
ipsilon-cc160379676d2cdede9339d169b10976613ebbbf.zip
Add nameid values validation
Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'ipsilon/providers/saml2/admin.py')
-rwxr-xr-xipsilon/providers/saml2/admin.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ipsilon/providers/saml2/admin.py b/ipsilon/providers/saml2/admin.py
index 2f346ce..0a5a88d 100755
--- a/ipsilon/providers/saml2/admin.py
+++ b/ipsilon/providers/saml2/admin.py
@@ -172,6 +172,8 @@ class SPAdminPage(Page):
self._debug("Replacing %s: %s -> %s" % (key,
self.sp.default_nameid,
value))
+ if not self.sp.is_valid_nameid(value):
+ raise InvalidValueFormat('Invalid default nameid value')
return {'default_nameid': value}
else:
raise UnauthorizedUser("Unauthorized to set default nameid value")
@@ -185,6 +187,11 @@ class SPAdminPage(Page):
self._debug("Replacing %s: %s -> %s" % (key,
self.sp.allowed_nameids,
list(v)))
+ for x in v:
+ if not self.sp.is_valid_nameid(x):
+ l = ', '.join(self.sp.valid_nameids())
+ err = 'Invalid nameid [%s]. Available [%s].' % (x, l)
+ raise InvalidValueFormat(err)
return {'allowed_nameids': list(v)}
else:
raise UnauthorizedUser("Unauthorized to set alowed nameids values")