Skip to content

Conversation

@JiriOndrusek
Copy link
Contributor

Issue: https://issues.apache.org/jira/browse/CAMEL-14780

Change adds method co change httpHandler into SPI API.
Extension of API is back compatible with previous version of API.
Added JUnit test validating htppHandler 'hook' and test for usage of security parameters defined on component.

[ ] Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
[ ] Each commit in the pull request should have a meaningful subject line and body.
[ ] If you're unsure, you can format the pull request title like [CAMEL-XXX] Fixes bug in camel-file component, where you replace CAMEL-XXX with the appropriate JIRA issue.
[ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
[ ] Run mvn clean install -Psourcecheck in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
Below are the contribution guidelines:
https://github.com/apache/camel/blob/master/CONTRIBUTING.md

Copy link
Contributor

@oscerd oscerd left a comment

Choose a reason for hiding this comment

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

LGTM, I saw the PR template was completely ignored.. that's what I was afraid of, I think we can safely remove it @davsclaus

@Metadata(label = "security")
private String allowedRoles;

private UndertowSecurityProvider securityProvider;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add @metadata with security label.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davsclaus this is not parameter which comes from configuration, it is just private variable that is used by component when SPI implementation is searched for. From my POV there should be annotation like @nometadata in tis case.

this.allowedRoles = allowedRoles;
}

public UndertowSecurityProvider getSecurityProvider() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add setter so you can set this explicit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do it also this way, in that case please ignore my previous comment

protected void doStart() throws Exception {
super.doStart();

initSecurityProvider();
Copy link
Contributor

Choose a reason for hiding this comment

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

Only init if the security provider is null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it


public UndertowSecurityProvider getSecurityProvider() {
return securityProvider;
if (this.securityProvider == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

getter/setters should be plain, not these tricks. Instead when creating the endpoint in the component, then set the security provider on the endpoint correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I'll do it, thanks for explanation



public String getAllowedRoles() {
return allowedRoles == null ? getComponent().getAllowedRoles() : allowedRoles;
Copy link
Contributor

Choose a reason for hiding this comment

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

See prev comment, getter/setter should be plain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it

@JiriOndrusek
Copy link
Contributor Author

@oscerd I've seen the template, I'll read it, validated all steps. Should it be used in any other way?

@oscerd
Copy link
Contributor

oscerd commented Mar 25, 2020

There was a contribution about that, but I'm not really sure is useful, too much text.. People may lose attention

@omarsmak
Copy link
Member

@oscerd I'd say we keep it for sometime and see if people will respond to it :p. But yeah maybe we can reduce it a bit, an example a beam PR

@JiriOndrusek JiriOndrusek force-pushed the CAMEL-14780_SPI_API_httpHandler branch from 54a3cbe to a77ee78 Compare March 25, 2020 11:07
@JiriOndrusek
Copy link
Contributor Author

@davsclaus All requested changes added

@davsclaus davsclaus merged commit 050c091 into apache:master Mar 25, 2020
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.

4 participants