You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

591 lines
25 KiB

  1. # Copyright 2020 Quentin Gliech
  2. # Copyright 2020-2021 The Matrix.org Foundation C.I.C.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from collections import Counter
  16. from typing import Iterable, List, Mapping, Optional, Tuple, Type
  17. import attr
  18. from synapse.config._util import validate_config
  19. from synapse.config.sso import SsoAttributeRequirement
  20. from synapse.python_dependencies import DependencyException, check_requirements
  21. from synapse.types import Collection, JsonDict
  22. from synapse.util.module_loader import load_module
  23. from synapse.util.stringutils import parse_and_validate_mxc_uri
  24. from ._base import Config, ConfigError, read_file
  25. DEFAULT_USER_MAPPING_PROVIDER = "synapse.handlers.oidc_handler.JinjaOidcMappingProvider"
  26. class OIDCConfig(Config):
  27. section = "oidc"
  28. def read_config(self, config, **kwargs):
  29. self.oidc_providers = tuple(_parse_oidc_provider_configs(config))
  30. if not self.oidc_providers:
  31. return
  32. try:
  33. check_requirements("oidc")
  34. except DependencyException as e:
  35. raise ConfigError(
  36. e.message # noqa: B306, DependencyException.message is a property
  37. ) from e
  38. # check we don't have any duplicate idp_ids now. (The SSO handler will also
  39. # check for duplicates when the REST listeners get registered, but that happens
  40. # after synapse has forked so doesn't give nice errors.)
  41. c = Counter([i.idp_id for i in self.oidc_providers])
  42. for idp_id, count in c.items():
  43. if count > 1:
  44. raise ConfigError(
  45. "Multiple OIDC providers have the idp_id %r." % idp_id
  46. )
  47. public_baseurl = self.public_baseurl
  48. if public_baseurl is None:
  49. raise ConfigError("oidc_config requires a public_baseurl to be set")
  50. self.oidc_callback_url = public_baseurl + "_synapse/client/oidc/callback"
  51. @property
  52. def oidc_enabled(self) -> bool:
  53. # OIDC is enabled if we have a provider
  54. return bool(self.oidc_providers)
  55. def generate_config_section(self, config_dir_path, server_name, **kwargs):
  56. return """\
  57. # List of OpenID Connect (OIDC) / OAuth 2.0 identity providers, for registration
  58. # and login.
  59. #
  60. # Options for each entry include:
  61. #
  62. # idp_id: a unique identifier for this identity provider. Used internally
  63. # by Synapse; should be a single word such as 'github'.
  64. #
  65. # Note that, if this is changed, users authenticating via that provider
  66. # will no longer be recognised as the same user!
  67. #
  68. # (Use "oidc" here if you are migrating from an old "oidc_config"
  69. # configuration.)
  70. #
  71. # idp_name: A user-facing name for this identity provider, which is used to
  72. # offer the user a choice of login mechanisms.
  73. #
  74. # idp_icon: An optional icon for this identity provider, which is presented
  75. # by clients and Synapse's own IdP picker page. If given, must be an
  76. # MXC URI of the format mxc://<server-name>/<media-id>. (An easy way to
  77. # obtain such an MXC URI is to upload an image to an (unencrypted) room
  78. # and then copy the "url" from the source of the event.)
  79. #
  80. # idp_brand: An optional brand for this identity provider, allowing clients
  81. # to style the login flow according to the identity provider in question.
  82. # See the spec for possible options here.
  83. #
  84. # discover: set to 'false' to disable the use of the OIDC discovery mechanism
  85. # to discover endpoints. Defaults to true.
  86. #
  87. # issuer: Required. The OIDC issuer. Used to validate tokens and (if discovery
  88. # is enabled) to discover the provider's endpoints.
  89. #
  90. # client_id: Required. oauth2 client id to use.
  91. #
  92. # client_secret: oauth2 client secret to use. May be omitted if
  93. # client_secret_jwt_key is given, or if client_auth_method is 'none'.
  94. #
  95. # client_secret_jwt_key: Alternative to client_secret: details of a key used
  96. # to create a JSON Web Token to be used as an OAuth2 client secret. If
  97. # given, must be a dictionary with the following properties:
  98. #
  99. # key: a pem-encoded signing key. Must be a suitable key for the
  100. # algorithm specified. Required unless 'key_file' is given.
  101. #
  102. # key_file: the path to file containing a pem-encoded signing key file.
  103. # Required unless 'key' is given.
  104. #
  105. # jwt_header: a dictionary giving properties to include in the JWT
  106. # header. Must include the key 'alg', giving the algorithm used to
  107. # sign the JWT, such as "ES256", using the JWA identifiers in
  108. # RFC7518.
  109. #
  110. # jwt_payload: an optional dictionary giving properties to include in
  111. # the JWT payload. Normally this should include an 'iss' key.
  112. #
  113. # client_auth_method: auth method to use when exchanging the token. Valid
  114. # values are 'client_secret_basic' (default), 'client_secret_post' and
  115. # 'none'.
  116. #
  117. # scopes: list of scopes to request. This should normally include the "openid"
  118. # scope. Defaults to ["openid"].
  119. #
  120. # authorization_endpoint: the oauth2 authorization endpoint. Required if
  121. # provider discovery is disabled.
  122. #
  123. # token_endpoint: the oauth2 token endpoint. Required if provider discovery is
  124. # disabled.
  125. #
  126. # userinfo_endpoint: the OIDC userinfo endpoint. Required if discovery is
  127. # disabled and the 'openid' scope is not requested.
  128. #
  129. # jwks_uri: URI where to fetch the JWKS. Required if discovery is disabled and
  130. # the 'openid' scope is used.
  131. #
  132. # skip_verification: set to 'true' to skip metadata verification. Use this if
  133. # you are connecting to a provider that is not OpenID Connect compliant.
  134. # Defaults to false. Avoid this in production.
  135. #
  136. # user_profile_method: Whether to fetch the user profile from the userinfo
  137. # endpoint. Valid values are: 'auto' or 'userinfo_endpoint'.
  138. #
  139. # Defaults to 'auto', which fetches the userinfo endpoint if 'openid' is
  140. # included in 'scopes'. Set to 'userinfo_endpoint' to always fetch the
  141. # userinfo endpoint.
  142. #
  143. # allow_existing_users: set to 'true' to allow a user logging in via OIDC to
  144. # match a pre-existing account instead of failing. This could be used if
  145. # switching from password logins to OIDC. Defaults to false.
  146. #
  147. # user_mapping_provider: Configuration for how attributes returned from a OIDC
  148. # provider are mapped onto a matrix user. This setting has the following
  149. # sub-properties:
  150. #
  151. # module: The class name of a custom mapping module. Default is
  152. # {mapping_provider!r}.
  153. # See https://github.com/matrix-org/synapse/blob/master/docs/sso_mapping_providers.md#openid-mapping-providers
  154. # for information on implementing a custom mapping provider.
  155. #
  156. # config: Configuration for the mapping provider module. This section will
  157. # be passed as a Python dictionary to the user mapping provider
  158. # module's `parse_config` method.
  159. #
  160. # For the default provider, the following settings are available:
  161. #
  162. # subject_claim: name of the claim containing a unique identifier
  163. # for the user. Defaults to 'sub', which OpenID Connect
  164. # compliant providers should provide.
  165. #
  166. # localpart_template: Jinja2 template for the localpart of the MXID.
  167. # If this is not set, the user will be prompted to choose their
  168. # own username (see 'sso_auth_account_details.html' in the 'sso'
  169. # section of this file).
  170. #
  171. # display_name_template: Jinja2 template for the display name to set
  172. # on first login. If unset, no displayname will be set.
  173. #
  174. # email_template: Jinja2 template for the email address of the user.
  175. # If unset, no email address will be added to the account.
  176. #
  177. # extra_attributes: a map of Jinja2 templates for extra attributes
  178. # to send back to the client during login.
  179. # Note that these are non-standard and clients will ignore them
  180. # without modifications.
  181. #
  182. # When rendering, the Jinja2 templates are given a 'user' variable,
  183. # which is set to the claims returned by the UserInfo Endpoint and/or
  184. # in the ID Token.
  185. #
  186. # It is possible to configure Synapse to only allow logins if certain attributes
  187. # match particular values in the OIDC userinfo. The requirements can be listed under
  188. # `attribute_requirements` as shown below. All of the listed attributes must
  189. # match for the login to be permitted. Additional attributes can be added to
  190. # userinfo by expanding the `scopes` section of the OIDC config to retrieve
  191. # additional information from the OIDC provider.
  192. #
  193. # If the OIDC claim is a list, then the attribute must match any value in the list.
  194. # Otherwise, it must exactly match the value of the claim. Using the example
  195. # below, the `family_name` claim MUST be "Stephensson", but the `groups`
  196. # claim MUST contain "admin".
  197. #
  198. # attribute_requirements:
  199. # - attribute: family_name
  200. # value: "Stephensson"
  201. # - attribute: groups
  202. # value: "admin"
  203. #
  204. # See https://github.com/matrix-org/synapse/blob/master/docs/openid.md
  205. # for information on how to configure these options.
  206. #
  207. # For backwards compatibility, it is also possible to configure a single OIDC
  208. # provider via an 'oidc_config' setting. This is now deprecated and admins are
  209. # advised to migrate to the 'oidc_providers' format. (When doing that migration,
  210. # use 'oidc' for the idp_id to ensure that existing users continue to be
  211. # recognised.)
  212. #
  213. oidc_providers:
  214. # Generic example
  215. #
  216. #- idp_id: my_idp
  217. # idp_name: "My OpenID provider"
  218. # idp_icon: "mxc://example.com/mediaid"
  219. # discover: false
  220. # issuer: "https://accounts.example.com/"
  221. # client_id: "provided-by-your-issuer"
  222. # client_secret: "provided-by-your-issuer"
  223. # client_auth_method: client_secret_post
  224. # scopes: ["openid", "profile"]
  225. # authorization_endpoint: "https://accounts.example.com/oauth2/auth"
  226. # token_endpoint: "https://accounts.example.com/oauth2/token"
  227. # userinfo_endpoint: "https://accounts.example.com/userinfo"
  228. # jwks_uri: "https://accounts.example.com/.well-known/jwks.json"
  229. # skip_verification: true
  230. # user_mapping_provider:
  231. # config:
  232. # subject_claim: "id"
  233. # localpart_template: "{{{{ user.login }}}}"
  234. # display_name_template: "{{{{ user.name }}}}"
  235. # email_template: "{{{{ user.email }}}}"
  236. # attribute_requirements:
  237. # - attribute: userGroup
  238. # value: "synapseUsers"
  239. """.format(
  240. mapping_provider=DEFAULT_USER_MAPPING_PROVIDER
  241. )
  242. # jsonschema definition of the configuration settings for an oidc identity provider
  243. OIDC_PROVIDER_CONFIG_SCHEMA = {
  244. "type": "object",
  245. "required": ["issuer", "client_id"],
  246. "properties": {
  247. "idp_id": {
  248. "type": "string",
  249. "minLength": 1,
  250. # MSC2858 allows a maxlen of 255, but we prefix with "oidc-"
  251. "maxLength": 250,
  252. "pattern": "^[A-Za-z0-9._~-]+$",
  253. },
  254. "idp_name": {"type": "string"},
  255. "idp_icon": {"type": "string"},
  256. "idp_brand": {
  257. "type": "string",
  258. "minLength": 1,
  259. "maxLength": 255,
  260. "pattern": "^[a-z][a-z0-9_.-]*$",
  261. },
  262. "idp_unstable_brand": {
  263. "type": "string",
  264. "minLength": 1,
  265. "maxLength": 255,
  266. "pattern": "^[a-z][a-z0-9_.-]*$",
  267. },
  268. "discover": {"type": "boolean"},
  269. "issuer": {"type": "string"},
  270. "client_id": {"type": "string"},
  271. "client_secret": {"type": "string"},
  272. "client_secret_jwt_key": {
  273. "type": "object",
  274. "required": ["jwt_header"],
  275. "oneOf": [
  276. {"required": ["key"]},
  277. {"required": ["key_file"]},
  278. ],
  279. "properties": {
  280. "key": {"type": "string"},
  281. "key_file": {"type": "string"},
  282. "jwt_header": {
  283. "type": "object",
  284. "required": ["alg"],
  285. "properties": {
  286. "alg": {"type": "string"},
  287. },
  288. "additionalProperties": {"type": "string"},
  289. },
  290. "jwt_payload": {
  291. "type": "object",
  292. "additionalProperties": {"type": "string"},
  293. },
  294. },
  295. },
  296. "client_auth_method": {
  297. "type": "string",
  298. # the following list is the same as the keys of
  299. # authlib.oauth2.auth.ClientAuth.DEFAULT_AUTH_METHODS. We inline it
  300. # to avoid importing authlib here.
  301. "enum": ["client_secret_basic", "client_secret_post", "none"],
  302. },
  303. "scopes": {"type": "array", "items": {"type": "string"}},
  304. "authorization_endpoint": {"type": "string"},
  305. "token_endpoint": {"type": "string"},
  306. "userinfo_endpoint": {"type": "string"},
  307. "jwks_uri": {"type": "string"},
  308. "skip_verification": {"type": "boolean"},
  309. "user_profile_method": {
  310. "type": "string",
  311. "enum": ["auto", "userinfo_endpoint"],
  312. },
  313. "allow_existing_users": {"type": "boolean"},
  314. "user_mapping_provider": {"type": ["object", "null"]},
  315. "attribute_requirements": {
  316. "type": "array",
  317. "items": SsoAttributeRequirement.JSON_SCHEMA,
  318. },
  319. },
  320. }
  321. # the same as OIDC_PROVIDER_CONFIG_SCHEMA, but with compulsory idp_id and idp_name
  322. OIDC_PROVIDER_CONFIG_WITH_ID_SCHEMA = {
  323. "allOf": [OIDC_PROVIDER_CONFIG_SCHEMA, {"required": ["idp_id", "idp_name"]}]
  324. }
  325. # the `oidc_providers` list can either be None (as it is in the default config), or
  326. # a list of provider configs, each of which requires an explicit ID and name.
  327. OIDC_PROVIDER_LIST_SCHEMA = {
  328. "oneOf": [
  329. {"type": "null"},
  330. {"type": "array", "items": OIDC_PROVIDER_CONFIG_WITH_ID_SCHEMA},
  331. ]
  332. }
  333. # the `oidc_config` setting can either be None (which it used to be in the default
  334. # config), or an object. If an object, it is ignored unless it has an "enabled: True"
  335. # property.
  336. #
  337. # It's *possible* to represent this with jsonschema, but the resultant errors aren't
  338. # particularly clear, so we just check for either an object or a null here, and do
  339. # additional checks in the code.
  340. OIDC_CONFIG_SCHEMA = {"oneOf": [{"type": "null"}, {"type": "object"}]}
  341. # the top-level schema can contain an "oidc_config" and/or an "oidc_providers".
  342. MAIN_CONFIG_SCHEMA = {
  343. "type": "object",
  344. "properties": {
  345. "oidc_config": OIDC_CONFIG_SCHEMA,
  346. "oidc_providers": OIDC_PROVIDER_LIST_SCHEMA,
  347. },
  348. }
  349. def _parse_oidc_provider_configs(config: JsonDict) -> Iterable["OidcProviderConfig"]:
  350. """extract and parse the OIDC provider configs from the config dict
  351. The configuration may contain either a single `oidc_config` object with an
  352. `enabled: True` property, or a list of provider configurations under
  353. `oidc_providers`, *or both*.
  354. Returns a generator which yields the OidcProviderConfig objects
  355. """
  356. validate_config(MAIN_CONFIG_SCHEMA, config, ())
  357. for i, p in enumerate(config.get("oidc_providers") or []):
  358. yield _parse_oidc_config_dict(p, ("oidc_providers", "<item %i>" % (i,)))
  359. # for backwards-compatibility, it is also possible to provide a single "oidc_config"
  360. # object with an "enabled: True" property.
  361. oidc_config = config.get("oidc_config")
  362. if oidc_config and oidc_config.get("enabled", False):
  363. # MAIN_CONFIG_SCHEMA checks that `oidc_config` is an object, but not that
  364. # it matches OIDC_PROVIDER_CONFIG_SCHEMA (see the comments on OIDC_CONFIG_SCHEMA
  365. # above), so now we need to validate it.
  366. validate_config(OIDC_PROVIDER_CONFIG_SCHEMA, oidc_config, ("oidc_config",))
  367. yield _parse_oidc_config_dict(oidc_config, ("oidc_config",))
  368. def _parse_oidc_config_dict(
  369. oidc_config: JsonDict, config_path: Tuple[str, ...]
  370. ) -> "OidcProviderConfig":
  371. """Take the configuration dict and parse it into an OidcProviderConfig
  372. Raises:
  373. ConfigError if the configuration is malformed.
  374. """
  375. ump_config = oidc_config.get("user_mapping_provider", {})
  376. ump_config.setdefault("module", DEFAULT_USER_MAPPING_PROVIDER)
  377. ump_config.setdefault("config", {})
  378. (
  379. user_mapping_provider_class,
  380. user_mapping_provider_config,
  381. ) = load_module(ump_config, config_path + ("user_mapping_provider",))
  382. # Ensure loaded user mapping module has defined all necessary methods
  383. required_methods = [
  384. "get_remote_user_id",
  385. "map_user_attributes",
  386. ]
  387. missing_methods = [
  388. method
  389. for method in required_methods
  390. if not hasattr(user_mapping_provider_class, method)
  391. ]
  392. if missing_methods:
  393. raise ConfigError(
  394. "Class %s is missing required "
  395. "methods: %s"
  396. % (
  397. user_mapping_provider_class,
  398. ", ".join(missing_methods),
  399. ),
  400. config_path + ("user_mapping_provider", "module"),
  401. )
  402. idp_id = oidc_config.get("idp_id", "oidc")
  403. # prefix the given IDP with a prefix specific to the SSO mechanism, to avoid
  404. # clashes with other mechs (such as SAML, CAS).
  405. #
  406. # We allow "oidc" as an exception so that people migrating from old-style
  407. # "oidc_config" format (which has long used "oidc" as its idp_id) can migrate to
  408. # a new-style "oidc_providers" entry without changing the idp_id for their provider
  409. # (and thereby invalidating their user_external_ids data).
  410. if idp_id != "oidc":
  411. idp_id = "oidc-" + idp_id
  412. # MSC2858 also specifies that the idp_icon must be a valid MXC uri
  413. idp_icon = oidc_config.get("idp_icon")
  414. if idp_icon is not None:
  415. try:
  416. parse_and_validate_mxc_uri(idp_icon)
  417. except ValueError as e:
  418. raise ConfigError(
  419. "idp_icon must be a valid MXC URI", config_path + ("idp_icon",)
  420. ) from e
  421. client_secret_jwt_key_config = oidc_config.get("client_secret_jwt_key")
  422. client_secret_jwt_key = None # type: Optional[OidcProviderClientSecretJwtKey]
  423. if client_secret_jwt_key_config is not None:
  424. keyfile = client_secret_jwt_key_config.get("key_file")
  425. if keyfile:
  426. key = read_file(keyfile, config_path + ("client_secret_jwt_key",))
  427. else:
  428. key = client_secret_jwt_key_config["key"]
  429. client_secret_jwt_key = OidcProviderClientSecretJwtKey(
  430. key=key,
  431. jwt_header=client_secret_jwt_key_config["jwt_header"],
  432. jwt_payload=client_secret_jwt_key_config.get("jwt_payload", {}),
  433. )
  434. # parse attribute_requirements from config (list of dicts) into a list of SsoAttributeRequirement
  435. attribute_requirements = [
  436. SsoAttributeRequirement(**x)
  437. for x in oidc_config.get("attribute_requirements", [])
  438. ]
  439. return OidcProviderConfig(
  440. idp_id=idp_id,
  441. idp_name=oidc_config.get("idp_name", "OIDC"),
  442. idp_icon=idp_icon,
  443. idp_brand=oidc_config.get("idp_brand"),
  444. unstable_idp_brand=oidc_config.get("unstable_idp_brand"),
  445. discover=oidc_config.get("discover", True),
  446. issuer=oidc_config["issuer"],
  447. client_id=oidc_config["client_id"],
  448. client_secret=oidc_config.get("client_secret"),
  449. client_secret_jwt_key=client_secret_jwt_key,
  450. client_auth_method=oidc_config.get("client_auth_method", "client_secret_basic"),
  451. scopes=oidc_config.get("scopes", ["openid"]),
  452. authorization_endpoint=oidc_config.get("authorization_endpoint"),
  453. token_endpoint=oidc_config.get("token_endpoint"),
  454. userinfo_endpoint=oidc_config.get("userinfo_endpoint"),
  455. jwks_uri=oidc_config.get("jwks_uri"),
  456. skip_verification=oidc_config.get("skip_verification", False),
  457. user_profile_method=oidc_config.get("user_profile_method", "auto"),
  458. allow_existing_users=oidc_config.get("allow_existing_users", False),
  459. user_mapping_provider_class=user_mapping_provider_class,
  460. user_mapping_provider_config=user_mapping_provider_config,
  461. attribute_requirements=attribute_requirements,
  462. )
  463. @attr.s(slots=True, frozen=True)
  464. class OidcProviderClientSecretJwtKey:
  465. # a pem-encoded signing key
  466. key = attr.ib(type=str)
  467. # properties to include in the JWT header
  468. jwt_header = attr.ib(type=Mapping[str, str])
  469. # properties to include in the JWT payload.
  470. jwt_payload = attr.ib(type=Mapping[str, str])
  471. @attr.s(slots=True, frozen=True)
  472. class OidcProviderConfig:
  473. # a unique identifier for this identity provider. Used in the 'user_external_ids'
  474. # table, as well as the query/path parameter used in the login protocol.
  475. idp_id = attr.ib(type=str)
  476. # user-facing name for this identity provider.
  477. idp_name = attr.ib(type=str)
  478. # Optional MXC URI for icon for this IdP.
  479. idp_icon = attr.ib(type=Optional[str])
  480. # Optional brand identifier for this IdP.
  481. idp_brand = attr.ib(type=Optional[str])
  482. # Optional brand identifier for the unstable API (see MSC2858).
  483. unstable_idp_brand = attr.ib(type=Optional[str])
  484. # whether the OIDC discovery mechanism is used to discover endpoints
  485. discover = attr.ib(type=bool)
  486. # the OIDC issuer. Used to validate tokens and (if discovery is enabled) to
  487. # discover the provider's endpoints.
  488. issuer = attr.ib(type=str)
  489. # oauth2 client id to use
  490. client_id = attr.ib(type=str)
  491. # oauth2 client secret to use. if `None`, use client_secret_jwt_key to generate
  492. # a secret.
  493. client_secret = attr.ib(type=Optional[str])
  494. # key to use to construct a JWT to use as a client secret. May be `None` if
  495. # `client_secret` is set.
  496. client_secret_jwt_key = attr.ib(type=Optional[OidcProviderClientSecretJwtKey])
  497. # auth method to use when exchanging the token.
  498. # Valid values are 'client_secret_basic', 'client_secret_post' and
  499. # 'none'.
  500. client_auth_method = attr.ib(type=str)
  501. # list of scopes to request
  502. scopes = attr.ib(type=Collection[str])
  503. # the oauth2 authorization endpoint. Required if discovery is disabled.
  504. authorization_endpoint = attr.ib(type=Optional[str])
  505. # the oauth2 token endpoint. Required if discovery is disabled.
  506. token_endpoint = attr.ib(type=Optional[str])
  507. # the OIDC userinfo endpoint. Required if discovery is disabled and the
  508. # "openid" scope is not requested.
  509. userinfo_endpoint = attr.ib(type=Optional[str])
  510. # URI where to fetch the JWKS. Required if discovery is disabled and the
  511. # "openid" scope is used.
  512. jwks_uri = attr.ib(type=Optional[str])
  513. # Whether to skip metadata verification
  514. skip_verification = attr.ib(type=bool)
  515. # Whether to fetch the user profile from the userinfo endpoint. Valid
  516. # values are: "auto" or "userinfo_endpoint".
  517. user_profile_method = attr.ib(type=str)
  518. # whether to allow a user logging in via OIDC to match a pre-existing account
  519. # instead of failing
  520. allow_existing_users = attr.ib(type=bool)
  521. # the class of the user mapping provider
  522. user_mapping_provider_class = attr.ib(type=Type)
  523. # the config of the user mapping provider
  524. user_mapping_provider_config = attr.ib()
  525. # required attributes to require in userinfo to allow login/registration
  526. attribute_requirements = attr.ib(type=List[SsoAttributeRequirement])