def generateTicketStore(self, argstring=""): scp = load_settings('cas', syspath='/etc/cas') settings = export_settings_to_dict(scp) ts_props = settings.get('CAS', {}) ts_settings = settings.get('CouchDB', {}) settings_xlate = { 'host': 'couch_host', 'port': 'couch_port', 'db': 'couch_db', 'user': '******', 'passwd': 'couch_passwd', 'https': 'use_https', 'debug': '_debug', } temp = {} for k, v in ts_settings.iteritems(): k = settings_xlate.get(k, k) temp[k] = v ts_settings = temp del temp if argstring.strip() != "": argdict = dict((x.split('=') for x in argstring.split(':'))) ts_settings.update(argdict) missing = get_missing_args(CouchDBTicketStore.__init__, ts_settings, ['self']) if len(missing) > 0: sys.stderr.write("[ERROR][CouchDBTicketStore] " "Missing the following settings: %s" % ', '.join(missing)) sys.stderr.write('\n') sys.exit(1) props = ('lt_lifespan', 'st_lifespan', 'pt_lifespan', 'tgt_lifespan', 'pgt_lifespan', 'ticket_size', '_debug') ts_props = dict( (prop, int(ts_props[prop])) for prop in props if prop in ts_props) filter_args(CouchDBTicketStore.__init__, ts_settings, ['self']) if 'couch_port' in ts_settings: ts_settings['couch_port'] = int(ts_settings['couch_port']) if 'use_https' in ts_settings: ts_settings['use_https'] = get_bool(ts_settings['use_https']) if 'verify_cert' in ts_settings: ts_settings['verify_cert'] = get_bool(ts_settings['verify_cert']) if '_debug' in ts_settings: ts_settings['_debug'] = get_bool(ts_settings['_debug']) obj = CouchDBTicketStore(**ts_settings) for prop, value in ts_props.iteritems(): setattr(obj, prop, value) buf = ["[CONFIG][CouchDBTicketStore] Settings:"] d = dict(ts_settings) d.update(ts_props) for k in sorted(d.keys()): v = d[k] if k == 'couch_passwd': v = '*******' buf.append(" - %s: %s" % (k, v)) sys.stderr.write('\n'.join(buf)) sys.stderr.write('\n') return obj
def generateTicketStore(self, argstring=""): scp = load_settings('cas', syspath='/etc/cas') settings = export_settings_to_dict(scp) ts_props = settings.get('CAS', {}) ts_settings = settings.get('CouchDB', {}) settings_xlate = { 'host': 'couch_host', 'port': 'couch_port', 'db': 'couch_db', 'user': '******', 'passwd': 'couch_passwd', 'https': 'use_https', 'debug': '_debug', } temp = {} for k, v in ts_settings.iteritems(): k = settings_xlate.get(k, k) temp[k] = v ts_settings = temp del temp if argstring.strip() != "": argdict = dict((x.split('=') for x in argstring.split(':'))) ts_settings.update(argdict) missing = get_missing_args( CouchDBTicketStore.__init__, ts_settings, ['self']) if len(missing) > 0: sys.stderr.write( "[ERROR][CouchDBTicketStore] " "Missing the following settings: %s" % ', '.join(missing)) sys.stderr.write('\n') sys.exit(1) props = ( 'lt_lifespan', 'st_lifespan', 'pt_lifespan', 'tgt_lifespan', 'pgt_lifespan', 'ticket_size', '_debug') ts_props = dict((prop, int(ts_props[prop])) for prop in props if prop in ts_props) filter_args(CouchDBTicketStore.__init__, ts_settings, ['self']) if 'couch_port' in ts_settings: ts_settings['couch_port'] = int(ts_settings['couch_port']) if 'use_https' in ts_settings: ts_settings['use_https'] = get_bool(ts_settings['use_https']) if 'verify_cert' in ts_settings: ts_settings['verify_cert'] = get_bool(ts_settings['verify_cert']) if '_debug' in ts_settings: ts_settings['_debug'] = get_bool(ts_settings['_debug']) obj = CouchDBTicketStore(**ts_settings) for prop, value in ts_props.iteritems(): setattr(obj, prop, value) buf = ["[CONFIG][CouchDBTicketStore] Settings:"] d = dict(ts_settings) d.update(ts_props) for k in sorted(d.keys()): v = d[k] if k == 'couch_passwd': v = '*******' buf.append(" - %s: %s" % (k, v)) sys.stderr.write('\n'.join(buf)) sys.stderr.write('\n') return obj
def __init__( self, endpointstr, basedn, binddn, bindpw, query_template="(uid=%(username)s)", attribs=None, aliases=None, service_based_attribs=False, start_tls=False, start_tls_hostname=None, start_tls_cacert=None, ): if attribs is None: attribs = [] # Turn attribs into mapping of attrib_name => alias. if aliases is not None: assert len(aliases) == len(attribs), "[ERROR][LDAP REALM] Number of aliases must match number of attribs." attribs = dict(x for x in zip(attribs, aliases)) else: attribs = dict((k, k) for k in attribs) self._attribs = attribs self._endpointstr = endpointstr self._basedn = basedn self._binddn = binddn self._bindpw = bindpw self._query_template = query_template self._service_based_attribs = service_based_attribs self._startTls = get_bool(start_tls) self._startTlsAuthority = self.getTlsAuthority_(start_tls_cacert) self._startTlsHostName = start_tls_hostname
def __init__(self, endpointstr, basedn, binddn, bindpw, query_template='(uid=%(username)s)', attribs=None, aliases=None, service_based_attribs=False, start_tls=False, start_tls_hostname=None, start_tls_cacert=None): if attribs is None: attribs = [] # Turn attribs into mapping of attrib_name => alias. if aliases is not None: assert len(aliases) == len( attribs ), "[ERROR][LDAP REALM] Number of aliases must match number of attribs." attribs = dict(x for x in zip(attribs, aliases)) else: attribs = dict((k, k) for k in attribs) self._attribs = attribs self._endpointstr = endpointstr self._basedn = basedn self._binddn = binddn self._bindpw = bindpw self._query_template = query_template self._service_based_attribs = service_based_attribs self._startTls = get_bool(start_tls) self._startTlsAuthority = self.getTlsAuthority_(start_tls_cacert) self._startTlsHostName = start_tls_hostname
def generateRealm(self, argstring=""): scp = load_settings('cas', syspath='/etc/cas') settings = export_settings_to_dict(scp) ldap_settings = settings.get('LDAP', {}) temp = settings.get("LDAPRealm", {}) ldap_settings.update(temp) del temp if argstring.strip() != "": argdict = dict((x.split('=') for x in argstring.split(':'))) ldap_settings.update(argdict) missing = txcas.utils.get_missing_args(LDAPRealm.__init__, ldap_settings, ['self']) if len(missing) > 0: sys.stderr.write("[ERROR][LDAPRealm] " "Missing the following settings: %s" % ', '.join(missing)) sys.stderr.write('\n') sys.exit(1) if 'attribs' in ldap_settings: attribs = ldap_settings['attribs'] attribs = attribs.split(',') ldap_settings['attribs'] = attribs if 'aliases' in ldap_settings: aliases = ldap_settings['aliases'] aliases = aliases.split(',') ldap_settings['aliases'] = aliases if 'service_based_attribs' in ldap_settings: ldap_settings['service_based_attribs'] = get_bool( ldap_settings['service_based_attribs']) if 'start_tls' in ldap_settings: ldap_settings['start_tls'] = get_bool(ldap_settings['start_tls']) txcas.utils.filter_args(LDAPRealm.__init__, ldap_settings, ['self']) buf = ["[CONFIG][LDAPRealm] Settings:"] for k in sorted(ldap_settings.keys()): if k != "bindpw": v = ldap_settings[k] else: v = "*******" buf.append(" - %s: %s" % (k, v)) sys.stderr.write('\n'.join(buf)) sys.stderr.write('\n') return LDAPRealm(**ldap_settings)
def generateRealm(self, argstring=""): scp = load_settings("cas", syspath="/etc/cas") settings = export_settings_to_dict(scp) ldap_settings = settings.get("LDAP", {}) temp = settings.get("LDAPRealm", {}) ldap_settings.update(temp) del temp if argstring.strip() != "": argdict = dict((x.split("=") for x in argstring.split(":"))) ldap_settings.update(argdict) missing = txcas.utils.get_missing_args(LDAPRealm.__init__, ldap_settings, ["self"]) if len(missing) > 0: sys.stderr.write("[ERROR][LDAPRealm] " "Missing the following settings: %s" % ", ".join(missing)) sys.stderr.write("\n") sys.exit(1) if "attribs" in ldap_settings: attribs = ldap_settings["attribs"] attribs = attribs.split(",") ldap_settings["attribs"] = attribs if "aliases" in ldap_settings: aliases = ldap_settings["aliases"] aliases = aliases.split(",") ldap_settings["aliases"] = aliases if "service_based_attribs" in ldap_settings: ldap_settings["service_based_attribs"] = get_bool(ldap_settings["service_based_attribs"]) if "start_tls" in ldap_settings: ldap_settings["start_tls"] = get_bool(ldap_settings["start_tls"]) txcas.utils.filter_args(LDAPRealm.__init__, ldap_settings, ["self"]) buf = ["[CONFIG][LDAPRealm] Settings:"] for k in sorted(ldap_settings.keys()): if k != "bindpw": v = ldap_settings[k] else: v = "*******" buf.append(" - %s: %s" % (k, v)) sys.stderr.write("\n".join(buf)) sys.stderr.write("\n") return LDAPRealm(**ldap_settings)
def __init__(self, endpointstr, basedn, binddn, bindpw, query_template='(uid=%(username)s)', start_tls=False, start_tls_hostname=None, start_tls_cacert=None): self._endpointstr = endpointstr self._basedn = basedn self._binddn = binddn self._bindpw = bindpw self._query_template = query_template self._startTls = get_bool(start_tls) self._startTlsAuthority = self.getTlsAuthority_(start_tls_cacert) self._startTlsHostName = start_tls_hostname
def __init__( self, endpointstr, basedn, binddn, bindpw, query_template='(uid=%(username)s)', start_tls=False, start_tls_hostname=None, start_tls_cacert=None): self._endpointstr = endpointstr self._basedn = basedn self._binddn = binddn self._bindpw = bindpw self._query_template = query_template self._startTls = get_bool(start_tls) self._startTlsAuthority = self.getTlsAuthority_(start_tls_cacert) self._startTlsHostName = start_tls_hostname