Class: HttpdConfigmapGenerator::Oidc

Inherits:
Base
  • Object
show all
Defined in:
lib/httpd_configmap_generator/oidc.rb

Constant Summary collapse

AUTH =
{
  :type    => "openid-connect",
  :subtype => "oidc"
}.freeze

Constants inherited from Base

Base::APACHE_USER, Base::HTTP_KEYTAB, Base::IPA_COMMAND, Base::KERBEROS_CONFIG_FILE, Base::LDAP_ATTRS, Base::PAM_CONFIG, Base::SSSD_CONFIG, Base::TIMESTAMP_FORMAT

Constants included from Base::Network

Base::Network::HOSTNAME_COMMAND

Instance Attribute Summary

Attributes inherited from Base

#opts

Instance Method Summary collapse

Methods inherited from Base

#debug_msg, #err_msg, #info_msg, #initialize, #optional_options, #run_configure

Methods included from Base::Pam

#configure_pam

Methods included from Base::Network

#domain, #domain_from_host, #fetch_network_file, #host_reachable?, #realm, #update_hostname

Methods included from Base::Kerberos

#enable_kerberos_dns_lookups

Methods included from Base::FileHelper

#cp_template, #create_target_directory, #delete_target_file, #file_binary?, #path_join, #rm_file, #template_directory

Methods included from Base::ConfigHelper

#config_file_backup

Methods included from Base::Command

#command_run, #command_run!, #log_command_error

Constructor Details

This class inherits a constructor from HttpdConfigmapGenerator::Base

Instance Method Details

#configure(opts) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/httpd_configmap_generator/oidc.rb', line 20

def configure(opts)
  auth_oidc_data = {}
  auth_oidc_data["auth-oidc-provider-metadata-url"] = opts[:oidc_url]
  auth_oidc_data["auth-oidc-client-id"] = opts[:oidc_client_id]
  auth_oidc_data["auth-oidc-client-secret"] = opts[:oidc_client_secret]

  config_map = ConfigMap.new(opts)
  config_map.generate(AUTH[:type], nil, nil, auth_oidc_data )
  config_map.save(opts[:output])
rescue => err
  log_command_error(err)
  raise err
end

#configured?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/httpd_configmap_generator/oidc.rb', line 38

def configured?
  false
end

#required_optionsObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/httpd_configmap_generator/oidc.rb', line 9

def required_options
  super.merge(
    :oidc_url           => { :description => "OpenID-Connect Provider URL", 
                             :short       => "-u" },
    :oidc_client_id     => { :description => "OpenID-Connect Provider Client ID",
                             :short       => "-i" },
    :oidc_client_secret => { :description => "OpenID-Connect Provider Client Secret",
                             :short       => "-s" },
  )
end

#unconfigureObject



42
43
44
# File 'lib/httpd_configmap_generator/oidc.rb', line 42

def unconfigure
  return unless configured?
end

#validate_options(opts) ⇒ Object



34
35
36
# File 'lib/httpd_configmap_generator/oidc.rb', line 34

def validate_options(opts)
  super(opts)
end