Skip to content

Commit

Permalink
Adding ability to update the /authentication/mode
Browse files Browse the repository at this point in the history
as well as the /authentication/httpd_role
via bundle exec rake evm:settings

This is needed to allow the Authentication to be configured
from the appliance console CLI to SAML/OIDC and Back.
  • Loading branch information
abellotti committed Nov 14, 2019
1 parent 72ffca2 commit 297ea0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/tasks/evm_settings.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module EvmSettings
ALLOWED_KEYS ||= [
"/authentication/mode",
"/authentication/httpd_role",
"/authentication/sso_enabled",
"/authentication/saml_enabled",
"/authentication/oidc_enabled",
Expand Down
20 changes: 16 additions & 4 deletions spec/lib/tasks/evm_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

describe "EvmSettings", :type => :rake_task do
let(:task_path) { "lib/tasks/evm_settings" }
let(:keys) { ["/authentication/sso_enabled", "/authentication/saml_enabled", "/authentication/oidc_enabled", "/authentication/local_login_disabled"] }
let(:keys) { ["/authentication/mode", "/authentication/httpd_role", "/authentication/sso_enabled", "/authentication/saml_enabled", "/authentication/oidc_enabled", "/authentication/local_login_disabled"] }

describe ".get_keys" do
context "gets the current keys" do
it "when provider_type is none" do
@settings_hash =
{:authentication => {:user_type => "userprincipalname",
{:authentication => {:mode => "database",
:httpd_role => false,
:user_type => "userprincipalname",
:amazon_key => nil,
:oidc_enabled => false,
:saml_enabled => false,
Expand All @@ -18,6 +20,8 @@
:binary_blob => {:purge_window_size => 100}}

allow(Settings).to receive(:to_hash).and_return(@settings_hash)
expect(STDOUT).to receive(:puts).with("/authentication/mode=database")
expect(STDOUT).to receive(:puts).with("/authentication/httpd_role=false")
expect(STDOUT).to receive(:puts).with("/authentication/sso_enabled=false")
expect(STDOUT).to receive(:puts).with("/authentication/saml_enabled=false")
expect(STDOUT).to receive(:puts).with("/authentication/oidc_enabled=false")
Expand All @@ -28,7 +32,9 @@

it "when provider_type is oidc" do
@settings_hash =
{:authentication => {:user_type => "userprincipalname",
{:authentication => {:mode => "httpd",
:httpd_role => true,
:user_type => "userprincipalname",
:amazon_key => nil,
:oidc_enabled => true,
:saml_enabled => false,
Expand All @@ -38,6 +44,8 @@
:binary_blob => {:purge_window_size => 100}}

allow(Settings).to receive(:to_hash).and_return(@settings_hash)
expect(STDOUT).to receive(:puts).with("/authentication/mode=httpd")
expect(STDOUT).to receive(:puts).with("/authentication/httpd_role=true")
expect(STDOUT).to receive(:puts).with("/authentication/sso_enabled=false")
expect(STDOUT).to receive(:puts).with("/authentication/saml_enabled=false")
expect(STDOUT).to receive(:puts).with("/authentication/oidc_enabled=true")
Expand All @@ -48,7 +56,9 @@

it "when provider_type is saml" do
@settings_hash =
{:authentication => {:user_type => "userprincipalname",
{:authentication => {:mode => "httpd",
:httpd_role => true,
:user_type => "userprincipalname",
:amazon_key => nil,
:oidc_enabled => false,
:saml_enabled => true,
Expand All @@ -58,6 +68,8 @@
:binary_blob => {:purge_window_size => 100}}

allow(Settings).to receive(:to_hash).and_return(@settings_hash)
expect(STDOUT).to receive(:puts).with("/authentication/mode=httpd")
expect(STDOUT).to receive(:puts).with("/authentication/httpd_role=true")
expect(STDOUT).to receive(:puts).with("/authentication/sso_enabled=false")
expect(STDOUT).to receive(:puts).with("/authentication/saml_enabled=true")
expect(STDOUT).to receive(:puts).with("/authentication/oidc_enabled=false")
Expand Down

0 comments on commit 297ea0f

Please sign in to comment.