Module: ForemanRhCloud::CertAuth
- Extended by:
- ActiveSupport::Concern
- Includes:
- CloudRequest, InsightsCloud::CandlepinCache
- Included in:
- ForemanInventoryUpload::Async::RemoveInsightsHostsJob, CloudRequestForwarder, InsightsApiForwarder, Ping, RegistrationManagerExtensions, RemediationsRetriever, TagsAuth, InsightsCloud::Async::ConnectorPlaybookExecutionReporterTask, InsightsCloud::Async::InsightsFullSync, InsightsCloud::Async::InsightsResolutionsSync, InsightsCloud::Async::InsightsRulesSync, InsightsCloud::Async::VmaasReposcanSync, InventorySync::Async::QueryInventoryJob
- Defined in:
- app/services/foreman_rh_cloud/cert_auth.rb
Instance Method Summary
collapse
#candlepin_id_cert, #cp_owner_id, #upstream_owner
Instance Method Details
#cert_auth_available?(organization) ⇒ Boolean
8
9
10
|
# File 'app/services/foreman_rh_cloud/cert_auth.rb', line 8
def cert_auth_available?(organization)
!!candlepin_id_cert(organization)
end
|
#execute_cloud_request(params) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/services/foreman_rh_cloud/cert_auth.rb', line 12
def execute_cloud_request(params)
organization = params.delete(:organization)
with_iop_smart_proxy = ForemanRhCloud.with_iop_smart_proxy?
certs = with_iop_smart_proxy ? foreman_certificate : candlepin_id_cert(organization)
default_params = {
ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
ssl_client_key: OpenSSL::PKey.read(certs[:key]),
}
if with_iop_smart_proxy && organization&.label
default_params[:headers] = {
'X-Org-Id' => organization&.label,
}
end
final_params = default_params.deep_merge(params)
super(final_params)
end
|
#foreman_certificate ⇒ Object
33
34
35
36
37
38
|
# File 'app/services/foreman_rh_cloud/cert_auth.rb', line 33
def foreman_certificate
@foreman_certificate ||= {
cert: File.read(Setting[:ssl_certificate]),
key: File.read(Setting[:ssl_priv_key]),
}
end
|