Code cleanups and simplifications.

Also: share the saml client between redirect and response handlers.
This commit is contained in:
Richard van der Hoff 2019-06-11 00:03:57 +01:00
parent 69a43d9974
commit 426049247b
6 changed files with 53 additions and 50 deletions

View file

@ -12,6 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.python_dependencies import DependencyException, check_requirements
from ._base import Config, ConfigError
@ -25,6 +26,11 @@ class SAML2Config(Config):
if not saml2_config or not saml2_config.get("enabled", True):
return
try:
check_requirements('saml2')
except DependencyException as e:
raise ConfigError(e.message)
self.saml2_enabled = True
import saml2.config
@ -75,7 +81,6 @@ class SAML2Config(Config):
# override them.
#
#saml2_config:
# enabled: true
# sp_config:
# # point this to the IdP's metadata. You can use either a local file or
# # (preferably) a URL.