-
Notifications
You must be signed in to change notification settings - Fork 240
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: use new Configuration Injection mechanism everywhere #4633
feat: use new Configuration Injection mechanism everywhere #4633
Conversation
ea6551c
to
b5a9a79
Compare
b5a9a79
to
7a5d4e0
Compare
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new NotBeforeValidationRule(clock, configuration.getNotBeforeValidationLeeway())); | ||
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new ExpirationIssuedAtValidationRule(clock, configuration.getIssuedAtLeeway())); | ||
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new AudienceValidationRule(config.getEndpointAudience())); | ||
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new NotBeforeValidationRule(clock, config.getNotBeforeValidationLeeway())); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note
NotBeforeValidationRule.NotBeforeValidationRule
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new ExpirationIssuedAtValidationRule(clock, configuration.getIssuedAtLeeway())); | ||
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new AudienceValidationRule(config.getEndpointAudience())); | ||
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new NotBeforeValidationRule(clock, config.getNotBeforeValidationLeeway())); | ||
tokenValidationRulesRegistry.addRule(OAUTH2_TOKEN_CONTEXT, new ExpirationIssuedAtValidationRule(clock, config.getIssuedAtLeeway())); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note
ExpirationIssuedAtValidationRule.ExpirationIssuedAtValidationRule
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.
just some nits, is not easy to go deep in this :)
about the DependencyInjectionExtension
, why not have the Configuration
object automatically injected as mock objects so in every test the object can be controlled accordingly?
...ommon/junit/src/main/java/org/eclipse/edc/junit/extensions/DependencyInjectionExtension.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/eclipse/edc/connector/dataplane/selector/DataPlaneSelectorExtension.java
Outdated
Show resolved
Hide resolved
yeah, i know, unfortunately there isn't a good way to segment this PR :(
config objects ( Maybe we could come up with a more elegant solution how config values are injected in the |
What this PR changes/adds
This PR upgrades the entire code base to use the new Configuration Injection feature that was developed recently.
Note that this does not include:
ServiceExtensionContext
context
attribute, as that is not yet implementedWhy it does that
reduce code verbosity
Further notes
ObjectFactory
has to be used to construct the extension, because at the time the extension is injected into the test method, it is already fully constructed (i.e. all config values are already assigned) and that means, that mocking config values in the test method is not possible, because it's too late. Directly injecting the extension into test methods only works when the config is set directly in the@BeforeEach
method.Linked Issue(s)
Closes #4610
Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.