Skip to content

Commit

Permalink
Add relaxed SSL setting to replication agent when destination is HTTP…
Browse files Browse the repository at this point in the history
…S #RS-194
  • Loading branch information
cliffano committed Jul 29, 2024
1 parent 73bb3f1 commit 46e0c48
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added
- Add relaxed SSL setting to replication agent when destination is HTTPS #RS-194

## 3.16.1 - 2022-11-30
### Fixed
- Fix inconsistent swagger_aem runtime dependency in gemspec
Expand Down
24 changes: 14 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
diff-lcs (1.5.0)
docile (1.4.0)
diff-lcs (1.5.1)
docile (1.4.1)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
jaro_winkler (1.5.4)
json (2.6.2)
ffi (1.17.0)
ipaddr (1.2.6)
jaro_winkler (1.5.6)
json (2.7.2)
openssl (2.1.2)
parallel (1.22.1)
parser (3.1.3.0)
ipaddr
parallel (1.25.1)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
racc (1.8.0)
rainbow (3.1.1)
retries (0.0.5)
rspec (3.8.0)
Expand All @@ -35,7 +39,7 @@ GEM
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.11.0)
ruby-progressbar (1.13.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand All @@ -47,7 +51,7 @@ GEM
swagger_aem_osgi (1.0.0)
json (~> 2.1, >= 2.1.0)
typhoeus (~> 1.0, >= 1.0.1)
typhoeus (1.4.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
unicode-display_width (1.6.1)
yaml-lint (0.0.10)
Expand All @@ -68,4 +72,4 @@ DEPENDENCIES
yard (= 0.9.26)

BUNDLED WITH
2.3.21
2.4.22
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ Replication agent:
transport_user: 'admin',
transport_password: 'admin',
log_level: 'info',
retry_delay: 60_000
retry_delay: 60_000,
ssl: 'relaxed'
}
result = replication_agent.create_update('Some Replication Agent Title', 'Some replication agent description', 'http://somehost:8080', opts)

Expand Down
1 change: 1 addition & 0 deletions conf/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ replicationagent:
jcrcontent_retry_delay: '%{retry_delay}'
jcrcontent_cqtemplate: /libs/cq/replication/templates/agent
jcrcontent_enabled: true
jcrcontent_ssl: '%{ssl}'
responses:
200:
handler: simple
Expand Down
4 changes: 4 additions & 0 deletions lib/ruby_aem/resources/replication_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def create_update(
@call_params[:title] = title
@call_params[:description] = description
@call_params[:dest_base_url] = dest_base_url

uri = URI.parse(dest_base_url)
@call_params[:ssl] = uri.scheme == 'https' ? 'relaxed' : ''

@call_params = @call_params.merge(opts)
@client.call(self.class, __callee__.to_s, @call_params)
end
Expand Down
6 changes: 4 additions & 2 deletions test/unit/resources/replication_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
dest_base_url: 'http://somehost:8080',
transport_user: 'admin',
transport_password: 'admin',
ssl: '',
log_level: 'error',
retry_delay: 30_000
)
Expand All @@ -36,13 +37,14 @@
name: 'some-replication-agent',
title: 'Some replication Agent Title',
description: 'Some replication agent description',
dest_base_url: 'http://somehost:8080',
dest_base_url: 'https://somehost:8080',
transport_user: 'someuser',
transport_password: 'somepassword',
ssl: 'relaxed',
log_level: 'info',
retry_delay: 60_000
)
@replication_agent.create_update('Some replication Agent Title', 'Some replication agent description', 'http://somehost:8080', transport_user: 'someuser', transport_password: 'somepassword', log_level: 'info', retry_delay: 60_000)
@replication_agent.create_update('Some replication Agent Title', 'Some replication agent description', 'https://somehost:8080', transport_user: 'someuser', transport_password: 'somepassword', log_level: 'info', retry_delay: 60_000)
end
end

Expand Down

0 comments on commit 46e0c48

Please sign in to comment.