Skip to content

Dra 1788 load solrshield for each collection#73

Open
davidgrove73 wants to merge 16 commits intomasterfrom
DRA-1788-load-solrshield-for-each-collection
Open

Dra 1788 load solrshield for each collection#73
davidgrove73 wants to merge 16 commits intomasterfrom
DRA-1788-load-solrshield-for-each-collection

Conversation

@davidgrove73
Copy link
Copy Markdown
Contributor

Enable SolrShield to be loaded per collection with seperate configurations.
The following has been implemented:

  • Decoupling the SolrShield config from the rest of the ds-discover config
  • Refactored SolrShield from static utility class to instance class
  • Add logic to per collection instaciation of SolrShield in SolrManager
  • Removed the global extraAllowedParameters (not quite sure about this).

Static delegate methods preserved for backwards compatibility.
Decouples Profile from ServiceConfig. The passthrough list is now part
of the shield YAML, read by Profile directly.
Remove static SolrShield.ensureConfig() from ContextListener. Add
per-collection shield tests with permissive and restrictive configs.
New standalone ds-solrshield.yaml replaces the embedded solr.shield
section. Collection config now references it via the shield key.
Add defType to params in SearchComponent.java
Enable load of solrshield
Remove global extraAllowParameters and the global filter logic, and replace with a per collection filter.
Copy link
Copy Markdown
Contributor

@seskildsen seskildsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes.

Comment thread src/main/java/dk/kb/discover/util/solrshield/SolrShield.java
Comment thread src/main/java/dk/kb/discover/util/solrshield/SolrShield.java Outdated
Comment thread src/main/java/dk/kb/discover/util/solrshield/SolrShield.java Outdated
Comment thread src/test/java/dk/kb/discover/util/solrshield/SolrShieldTest.java
Comment thread src/test/java/dk/kb/discover/util/solrshield/SolrShieldTest.java
Comment thread src/test/java/dk/kb/discover/util/solrshield/SolrShieldTest.java Outdated
Comment thread src/test/java/dk/kb/discover/util/solrshield/SolrShieldTest.java Outdated
Comment thread src/test/java/dk/kb/discover/util/solrshield/SolrShieldTest.java Outdated
Comment thread src/main/java/dk/kb/discover/api/v1/impl/DsDiscoverApiServiceImpl.java Outdated
Comment thread src/main/java/dk/kb/discover/api/v1/impl/DsDiscoverApiServiceImpl.java Outdated
@thomasegense
Copy link
Copy Markdown
Contributor

When solrshield blocks a call only log a WARN with the message, and not whole stacktrace.

@thomasegense
Copy link
Copy Markdown
Contributor

It have deployed on ds-devel01 and testet it is working! Very nice work.

Copy link
Copy Markdown
Contributor

@thomasegense thomasegense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two changes:

  1. Double logic in serviceAPI class, would also like to move it to facade class.
  2. Do not log full stacktrace only single line WARN with message, if solrshield blocks request.

Comment thread src/main/java/dk/kb/discover/api/v1/impl/DsDiscoverApiServiceImpl.java Outdated
Remove '<p>' from javadoc
cosmetic changes from review
Do print exception stack trace on service exception thronw by solrshield. Bypass handleException.
Refactor: extract shield evaluation to own method
Copy link
Copy Markdown
Contributor

@thomasegense thomasegense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Removed extra newlines
cosmetic changes
Copy link
Copy Markdown
Contributor

@seskildsen seskildsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Remember to squash and merge. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants