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

added signingRequired parameter #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class SmbEndpoint extends GenericFileEndpoint<SmbFile> {
@UriParam
protected boolean dfs;

@UriParam
protected boolean signingRequired;

public SmbEndpoint(String uri, SmbComponent smbComponent, SmbConfiguration configuration) {
super(uri, smbComponent);
this.configuration = configuration;
Expand Down Expand Up @@ -87,6 +90,14 @@ public void setDfs(boolean dfsEnabled) {
this.dfs = dfsEnabled;
}

public boolean isSigningRequired() {
return signingRequired;
}

public void setSigningRequired(boolean signingRequired) {
this.signingRequired = signingRequired;
}

@Override
public Exchange createExchange(GenericFile<SmbFile> file) {
Exchange answer = new DefaultExchange(this);
Expand All @@ -108,6 +119,7 @@ private SmbConfig createSmbConfig() {
.builder()
.withMultiProtocolNegotiate(true)
.withDfsEnabled(isDfs())
.withSigningRequired(isSigningRequired())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class SmbEndpointSpec extends Specification {
def component = Mock(SmbComponent)
def config = new SmbConfiguration(new URI(uri))
def endpoint = new SmbEndpoint(uri, component, config)

//Camel usually sets this from URL
endpoint.setDfs(expectedDfs)
endpoint.isDfs() == expectedDfs
Expand All @@ -63,6 +64,21 @@ class SmbEndpointSpec extends Specification {
expectedDfs << [true, false]
}

def "signingRequired attribute is set up"() {
expect:
def uri = "smb2://server/share?signingRequired=true"
def component = Mock(SmbComponent)
def config = new SmbConfiguration(new URI(uri))
def endpoint = new SmbEndpoint(uri, component, config)

//Camel usually sets this from URL
endpoint.setSigningRequired(expectedSigningRequired)
endpoint.isSigningRequired() == expectedSigningRequired

where:
expectedSigningRequired << [true, false]
}

def "createProducer returns SmbProducer"() {
given:
def uri = "smb2://server/share?dfs=true"
Expand Down