Skip to content
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

Option to filter APIs based on their http-security #4

Closed
wrygiel opened this issue Aug 23, 2017 · 5 comments
Closed

Option to filter APIs based on their http-security #4

wrygiel opened this issue Aug 23, 2017 · 5 comments
Assignees

Comments

@wrygiel
Copy link
Contributor

wrygiel commented Aug 23, 2017

Previously, we wrote (here) that Java Registry Client won't help developers with filtering APIs based on their <http-security>. Quote:

  • If you are using the Java Registry Client, then you will need to use the findApis method (instead of the regular findApi), and filter the returned Collection<Element> yourself. The existing ApiSearchConditions class doesn't allow you to filter APIs based on the contents of their <http-security> element.
  • Note, that the existence of the <http-security> element depends on the designers of the particular API. EWP Registry does not force its APIs to use any single security model. It's up to the API designer to choose its security model. This way, many other APIs (such as EMREX, for example) can be easily included in the EWP Registry in the future (without them being forced to switch to our v2-security model). It also means, that Java Registry Client cannot "natively" allow you filter APIs based on their security settings.

However, I am not certain about this. Perhaps we can bend the rules a bit, and include some v2-security-specific code in the common Registry Client. After all, we expect that most APIs will follow v2-security, so it would make sense to allow ApiSearchConditions to filter on them.

Not sure how the new methods should look like though.

@wrygiel wrygiel self-assigned this Aug 23, 2017
@wrygiel
Copy link
Contributor Author

wrygiel commented Aug 23, 2017

Solution 1 - filter by a Predicate

Add a ApiSearchConditions method which would filter APIs by a supplied Predicate<Element>.

Predicate was introduced in Java 8. Perhaps we should use an alternative class to stay compatible with Java 7.

This method would allow client implementers to include any kind of filter. However, it's not very easy to use, because implementers will need to implement Predicates by themselves. Perhaps we can do better than that.

@wrygiel
Copy link
Contributor Author

wrygiel commented Aug 23, 2017

Solution 2 - setRequiredHttpSecurityOptions

We could also add a ApiSearchConditions.setRequiredHttpSecurityOptions method with would take:

  • A relative XPath expression pointing to the <http-security> element expected to be present in the Element. The namespace of the XPath expression would need to be the same as the namespace of the API entry itself. We could also have an overloaded implementation which would assume that the value for this XPath is simply ./http-security.
  • A new HttpSecurityOptions class which would describe the set of security methods supported by the client.

Perhaps we should name this method a bit differently, in order to make it obvious that not all APIs declare these security options. For example, setRequiredEwpV2Security.

@wrygiel
Copy link
Contributor Author

wrygiel commented Aug 23, 2017

If we choose solution 2 though, then we will need to update the Registry Client every time a change occurs in any of the security-entries.xsd files (which are defined in repositories of each security method). It will become somewhat messy. Perhaps it would be better to choose Solution 1, and possibly publish a separate "v2-securty" library for generating Predicates.

Unfortunately, I am leaving for vacation now, so I won't have time to solve this issue in the next weeks. For now, implementers should implement the filtering by themselves.

@wrygiel
Copy link
Contributor Author

wrygiel commented Jan 4, 2018

I'm not sure how much "wanted" this feature is. Should I try to implement it before a leave the project?

@Emkas
Copy link
Contributor

Emkas commented Oct 20, 2022

As of 2022, we have just one security option. I think this issue can be closed as 'Won't fix'.

@mkurzydlowski mkurzydlowski closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants