diff options
author | Steven Hammerton <steven.hammerton@openmarket.com> | 2015-10-12 11:11:49 +0100 |
---|---|---|
committer | Steven Hammerton <steven.hammerton@openmarket.com> | 2015-10-12 11:11:49 +0100 |
commit | 76421c496d1ee4ba5ea97fb24466156d0ddc0723 (patch) | |
tree | 42fe987fc33a9ba00b4af6aa8478b831b3a0c414 /synapse/config/cas.py | |
parent | Parse both user and attributes from CAS response (diff) | |
download | synapse-76421c496d1ee4ba5ea97fb24466156d0ddc0723.tar.xz |
Allow optional config params for a required attribute and it's value, if specified any CAS user must have the given attribute and the value must equal
Diffstat (limited to 'synapse/config/cas.py')
-rw-r--r-- | synapse/config/cas.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/config/cas.py b/synapse/config/cas.py index 81d034e8f0..4d1dd8cc7b 100644 --- a/synapse/config/cas.py +++ b/synapse/config/cas.py @@ -27,13 +27,28 @@ class CasConfig(Config): if cas_config: self.cas_enabled = True self.cas_server_url = cas_config["server_url"] + + if "required_attribute" in cas_config: + self.cas_required_attribute = cas_config["required_attribute"] + else: + self.cas_required_attribute = None + + if "required_attribute_value" in cas_config: + self.cas_required_attribute_value = cas_config["required_attribute_value"] + else: + self.cas_required_attribute_value = None + else: self.cas_enabled = False self.cas_server_url = None + self.cas_required_attribute = None + self.cas_required_attribute_value = None def default_config(self, config_dir_path, server_name, **kwargs): return """ # Enable CAS for registration and login. #cas_config: # server_url: "https://cas-server.com" + # #required_attribute: something + # #required_attribute_value: true """ |