##// END OF EJS Templates
authn: Add whitespace stripping to authentication plugin settings.
johbo -
r55:0ca726bb default
parent child Browse files
Show More
@@ -26,6 +26,7 b' from sqlalchemy.ext.hybrid import hybrid'
26 26 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
27 27 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
28 28 from rhodecode.authentication.routes import AuthnPluginResourceBase
29 from rhodecode.lib.colander_utils import strip_whitespace
29 30 from rhodecode.lib.utils2 import str2bool, safe_unicode
30 31 from rhodecode.model.db import User
31 32 from rhodecode.translation import _
@@ -52,12 +53,14 b' class ContainerSettingsSchema(AuthnPlugi'
52 53 colander.String(),
53 54 default='REMOTE_USER',
54 55 description=_('Header to extract the user from'),
56 preparer=strip_whitespace,
55 57 title=_('Header'),
56 58 widget='string')
57 59 fallback_header = colander.SchemaNode(
58 60 colander.String(),
59 61 default='HTTP_X_FORWARDED_USER',
60 62 description=_('Header to extract the user from when main one fails'),
63 preparer=strip_whitespace,
61 64 title=_('Fallback header'),
62 65 widget='string')
63 66 clean_username = colander.SchemaNode(
@@ -34,6 +34,7 b' from sqlalchemy.ext.hybrid import hybrid'
34 34 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
35 35 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
36 36 from rhodecode.authentication.routes import AuthnPluginResourceBase
37 from rhodecode.lib.colander_utils import strip_whitespace
37 38 from rhodecode.lib.ext_json import json, formatted_json
38 39 from rhodecode.model.db import User
39 40
@@ -58,12 +59,14 b' class CrowdSettingsSchema(AuthnPluginSet'
58 59 colander.String(),
59 60 default='127.0.0.1',
60 61 description=_('The FQDN or IP of the Atlassian CROWD Server'),
62 preparer=strip_whitespace,
61 63 title=_('Host'),
62 64 widget='string')
63 65 port = colander.SchemaNode(
64 66 colander.Int(),
65 67 default=8095,
66 68 description=_('The Port in use by the Atlassian CROWD Server'),
69 preparer=strip_whitespace,
67 70 title=_('Port'),
68 71 validator=colander.Range(min=0, max=65536),
69 72 widget='int')
@@ -71,12 +74,14 b' class CrowdSettingsSchema(AuthnPluginSet'
71 74 colander.String(),
72 75 default='',
73 76 description=_('The Application Name to authenticate to CROWD'),
77 preparer=strip_whitespace,
74 78 title=_('Application Name'),
75 79 widget='string')
76 80 app_password = colander.SchemaNode(
77 81 colander.String(),
78 82 default='',
79 83 description=_('The password to authenticate to CROWD'),
84 preparer=strip_whitespace,
80 85 title=_('Application Password'),
81 86 widget='password')
82 87 admin_groups = colander.SchemaNode(
@@ -85,6 +90,7 b' class CrowdSettingsSchema(AuthnPluginSet'
85 90 description=_('A comma separated list of group names that identify '
86 91 'users as RhodeCode Administrators'),
87 92 missing='',
93 preparer=strip_whitespace,
88 94 title=_('Admin Groups'),
89 95 widget='string')
90 96
@@ -36,6 +36,7 b' from sqlalchemy.ext.hybrid import hybrid'
36 36 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
37 37 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
38 38 from rhodecode.authentication.routes import AuthnPluginResourceBase
39 from rhodecode.lib.colander_utils import strip_whitespace
39 40 from rhodecode.lib.utils2 import safe_unicode
40 41 from rhodecode.model.db import User
41 42
@@ -60,6 +61,7 b' class JasigCasSettingsSchema(AuthnPlugin'
60 61 colander.String(),
61 62 default='https://domain.com/cas/v1/tickets',
62 63 description=_('The url of the Jasig CAS REST service'),
64 preparer=strip_whitespace,
63 65 title=_('URL'),
64 66 widget='string')
65 67
@@ -33,6 +33,7 b' from sqlalchemy.ext.hybrid import hybrid'
33 33 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
34 34 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
35 35 from rhodecode.authentication.routes import AuthnPluginResourceBase
36 from rhodecode.lib.colander_utils import strip_whitespace
36 37 from rhodecode.lib.exceptions import (
37 38 LdapConnectionError, LdapUsernameError, LdapPasswordError, LdapImportError
38 39 )
@@ -71,12 +72,14 b' class LdapSettingsSchema(AuthnPluginSett'
71 72 colander.String(),
72 73 default='',
73 74 description=_('Host of the LDAP Server'),
75 preparer=strip_whitespace,
74 76 title=_('LDAP Host'),
75 77 widget='string')
76 78 port = colander.SchemaNode(
77 79 colander.Int(),
78 80 default=389,
79 81 description=_('Port that the LDAP server is listening on'),
82 preparer=strip_whitespace,
80 83 title=_('Port'),
81 84 validator=colander.Range(min=0, max=65536),
82 85 widget='int')
@@ -85,6 +88,7 b' class LdapSettingsSchema(AuthnPluginSett'
85 88 default='',
86 89 description=_('User to connect to LDAP'),
87 90 missing='',
91 preparer=strip_whitespace,
88 92 title=_('Account'),
89 93 widget='string')
90 94 dn_pass = colander.SchemaNode(
@@ -92,6 +96,7 b' class LdapSettingsSchema(AuthnPluginSett'
92 96 default='',
93 97 description=_('Password to connect to LDAP'),
94 98 missing='',
99 preparer=strip_whitespace,
95 100 title=_('Password'),
96 101 widget='password')
97 102 tls_kind = colander.SchemaNode(
@@ -113,6 +118,7 b' class LdapSettingsSchema(AuthnPluginSett'
113 118 default='',
114 119 description=_('Base DN to search (e.g., dc=mydomain,dc=com)'),
115 120 missing='',
121 preparer=strip_whitespace,
116 122 title=_('Base DN'),
117 123 widget='string')
118 124 filter = colander.SchemaNode(
@@ -120,6 +126,7 b' class LdapSettingsSchema(AuthnPluginSett'
120 126 default='',
121 127 description=_('Filter to narrow results (e.g., ou=Users, etc)'),
122 128 missing='',
129 preparer=strip_whitespace,
123 130 title=_('LDAP Search Filter'),
124 131 widget='string')
125 132 search_scope = colander.SchemaNode(
@@ -133,14 +140,16 b' class LdapSettingsSchema(AuthnPluginSett'
133 140 colander.String(),
134 141 default='',
135 142 description=_('LDAP Attribute to map to user name'),
143 missing_msg=_('The LDAP Login attribute of the CN must be specified'),
144 preparer=strip_whitespace,
136 145 title=_('Login Attribute'),
137 missing_msg=_('The LDAP Login attribute of the CN must be specified'),
138 146 widget='string')
139 147 attr_firstname = colander.SchemaNode(
140 148 colander.String(),
141 149 default='',
142 150 description=_('LDAP Attribute to map to first name'),
143 151 missing='',
152 preparer=strip_whitespace,
144 153 title=_('First Name Attribute'),
145 154 widget='string')
146 155 attr_lastname = colander.SchemaNode(
@@ -148,6 +157,7 b' class LdapSettingsSchema(AuthnPluginSett'
148 157 default='',
149 158 description=_('LDAP Attribute to map to last name'),
150 159 missing='',
160 preparer=strip_whitespace,
151 161 title=_('Last Name Attribute'),
152 162 widget='string')
153 163 attr_email = colander.SchemaNode(
@@ -155,6 +165,7 b' class LdapSettingsSchema(AuthnPluginSett'
155 165 default='',
156 166 description=_('LDAP Attribute to map to email address'),
157 167 missing='',
168 preparer=strip_whitespace,
158 169 title=_('Email Attribute'),
159 170 widget='string')
160 171
@@ -35,6 +35,7 b' from sqlalchemy.ext.hybrid import hybrid'
35 35 from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin
36 36 from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase
37 37 from rhodecode.authentication.routes import AuthnPluginResourceBase
38 from rhodecode.lib.colander_utils import strip_whitespace
38 39
39 40 log = logging.getLogger(__name__)
40 41
@@ -57,6 +58,7 b' class PamSettingsSchema(AuthnPluginSetti'
57 58 colander.String(),
58 59 default='login',
59 60 description=_('PAM service name to use for authentication.'),
61 preparer=strip_whitespace,
60 62 title=_('PAM service name'),
61 63 widget='string')
62 64 gecos = colander.SchemaNode(
@@ -64,6 +66,7 b' class PamSettingsSchema(AuthnPluginSetti'
64 66 default='(?P<last_name>.+),\s*(?P<first_name>\w+)',
65 67 description=_('Regular expression for extracting user name/email etc. '
66 68 'from Unix userinfo.'),
69 preparer=strip_whitespace,
67 70 title=_('Gecos Regex'),
68 71 widget='string')
69 72
General Comments 0
You need to be logged in to leave comments. Login now