-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow multiple values for SSO attribute_requirements via comma separation #17949
base: develop
Are you sure you want to change the base?
feat: Allow multiple values for SSO attribute_requirements via comma separation #17949
Conversation
bc721c6
to
37c81f6
Compare
37c81f6
to
a6bc148
Compare
a6bc148
to
d83ceeb
Compare
I'm not sure whether the current change is really ideal or whether the JSON schema should be changed to a value list. |
297c68c
to
db1924a
Compare
synapse/config/sso.py
Outdated
@staticmethod | ||
def from_dict(attr_req: Dict[str, Any]) -> Self: | ||
attribute = attr_req["attribute"] | ||
value = attr_req.get("value") | ||
one_of = attr_req.get("one_of") | ||
return SsoAttributeRequirement(attribute, value, one_of) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is because it was vailing if value
or one_of
is missing? I think this is because they should have explicitly None
as default, e.g. value: Optional[str] = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I will try using default values, as you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm. Thanks for pointing in the right direction. 🙂
synapse/config/sso.py
Outdated
"oneOf": [ | ||
{"required": ["value"]}, | ||
{"required": ["one_of"]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that right? Does that mean that either value
or one_of
must be set? I thought it was possible to have neither of them set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, either value
or one_of
must be set. Before these changes, the JSON schema had value
listed as required
as well.
As far as I understand, value
can be None
, though. There is, however, no test case ensuring this. If you want I can implement one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted; a test would indeed be helpful!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa, this is confusing. The comment
# If a value is not given, than the attribute must simply exist.
value: Optional[str]
is and has been a lie since 6dade80, except for CAS, which uses a different JSON schema and thus bypasses the required rule a few lines below:
"required": ["attribute", "value"],
I updated the comment, so people don't need to find this out the hard way, as I did. 😉
A CAS test without a value
already exists.
db1924a
to
79e2068
Compare
41e901c
to
b506406
Compare
In the current
attribute_requirements
implementation it is only possible to allow exact matching attribute values. Multiple allowed values for one attribute are not possible as described in #13238.Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)