Skip to content

Commit e7d36e8

Browse files
author
Ciaran McCrisken
committed
(maint) Add tests for OIDC RedirectURL values
1 parent e91861a commit e7d36e8

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

spec/defines/vhost_spec.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,6 +2411,46 @@
24112411
end
24122412
end
24132413
end
2414+
context 'oidc_settings RedirectURL' do
2415+
describe 'with VALID relative URI' do
2416+
let :params do
2417+
default_params.merge(
2418+
'auth_oidc' => true,
2419+
'oidc_settings' => { 'ProviderMetadataURL' => 'https://login.example.com/.well-known/openid-configuration',
2420+
'ClientID' => 'test',
2421+
'RedirectURI' => '/some/valid/relative/uri',
2422+
'ProviderTokenEndpointAuth' => 'client_secret_basic',
2423+
'RemoteUserClaim' => 'sub',
2424+
'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8',
2425+
'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' },
2426+
)
2427+
end
2428+
2429+
it { is_expected.to compile }
2430+
it {
2431+
is_expected.to contain_concat__fragment('rspec.example.com-auth_oidc').with(
2432+
content: %r{^\s+OIDCRedirectURI\s/some/valid/relative/uri$},
2433+
)
2434+
}
2435+
end
2436+
2437+
describe 'with INVALID relative URI' do
2438+
let :params do
2439+
default_params.merge(
2440+
'auth_oidc' => true,
2441+
'oidc_settings' => { 'ProviderMetadataURL' => 'https://login.example.com/.well-known/openid-configuration',
2442+
'ClientID' => 'test',
2443+
'RedirectURI' => 'total_garbage',
2444+
'ProviderTokenEndpointAuth' => 'client_secret_basic',
2445+
'RemoteUserClaim' => 'sub',
2446+
'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8',
2447+
'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' },
2448+
)
2449+
end
2450+
2451+
it { is_expected.not_to compile }
2452+
end
2453+
end
24142454
end
24152455
end
24162456
end

0 commit comments

Comments
 (0)