-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16567 from jvlcek/openidc-rakefile
Enable OpenID-Connect in the appliance console.
- Loading branch information
Showing
2 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
require "rake" | ||
|
||
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"] } | ||
|
||
describe ".get_keys" do | ||
context "gets the current keys" do | ||
it "when provider_type is none" do | ||
@settings_hash = | ||
{:authentication => {:user_type => "userprincipalname", | ||
:amazon_key => nil, | ||
:oidc_enabled => false, | ||
:saml_enabled => false, | ||
:local_login_disabled => false, | ||
:provider_type => "none", | ||
:sso_enabled => false}, | ||
:binary_blob => {:purge_window_size => 100}} | ||
|
||
allow(Settings).to receive(:to_hash).and_return(@settings_hash) | ||
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") | ||
expect(STDOUT).to receive(:puts).with("/authentication/provider_type=none") | ||
expect(STDOUT).to receive(:puts).with("/authentication/local_login_disabled=false") | ||
EvmSettings.get_keys | ||
end | ||
|
||
it "when provider_type is oidc" do | ||
@settings_hash = | ||
{:authentication => {:user_type => "userprincipalname", | ||
:amazon_key => nil, | ||
:oidc_enabled => true, | ||
:saml_enabled => false, | ||
:local_login_disabled => false, | ||
:provider_type => "oidc", | ||
:sso_enabled => false}, | ||
:binary_blob => {:purge_window_size => 100}} | ||
|
||
allow(Settings).to receive(:to_hash).and_return(@settings_hash) | ||
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") | ||
expect(STDOUT).to receive(:puts).with("/authentication/provider_type=oidc") | ||
expect(STDOUT).to receive(:puts).with("/authentication/local_login_disabled=false") | ||
EvmSettings.get_keys | ||
end | ||
|
||
it "when provider_type is saml" do | ||
@settings_hash = | ||
{:authentication => {:user_type => "userprincipalname", | ||
:amazon_key => nil, | ||
:oidc_enabled => false, | ||
:saml_enabled => true, | ||
:local_login_disabled => false, | ||
:provider_type => "saml", | ||
:sso_enabled => false}, | ||
:binary_blob => {:purge_window_size => 100}} | ||
|
||
allow(Settings).to receive(:to_hash).and_return(@settings_hash) | ||
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") | ||
expect(STDOUT).to receive(:puts).with("/authentication/provider_type=saml") | ||
expect(STDOUT).to receive(:puts).with("/authentication/local_login_disabled=false") | ||
EvmSettings.get_keys | ||
end | ||
end | ||
end | ||
end |