Remove TrustedHostClientRegistrationPolicyTest#testGithubDomain

Closes #29271

Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
rmartinc 2024-07-23 09:49:05 +02:00 committed by Marek Posolda
parent dbd4079f92
commit 5db3772d45

View file

@ -16,8 +16,6 @@
*/
package org.keycloak.services.clientregistration.policy.impl;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@ -101,20 +99,6 @@ public class TrustedHostClientRegistrationPolicyTest {
policy.getTrustedHosts(), policy.getTrustedDomains()));
}
@Test
public void testGithubDomain() throws UnknownHostException {
TrustedHostClientRegistrationPolicyFactory factory = new TrustedHostClientRegistrationPolicyFactory();
ComponentModel model = createComponentModel("*.github.com");
TrustedHostClientRegistrationPolicy policy = (TrustedHostClientRegistrationPolicy) factory.create(session, model);
policy.verifyHost(InetAddress.getByName("www.github.com").getHostAddress());
policy.verifyHost(InetAddress.getByName("github.com").getHostAddress());
policy.checkURLTrusted("https://www.github.com", policy.getTrustedHosts(), policy.getTrustedDomains());
policy.checkURLTrusted("https://github.com", policy.getTrustedHosts(), policy.getTrustedDomains());
Assert.assertThrows(ClientRegistrationPolicyException.class, () -> policy.checkURLTrusted("https://othergithub.com",
policy.getTrustedHosts(), policy.getTrustedDomains()));
}
private ComponentModel createComponentModel(String... hosts) {
ComponentModel model = new ComponentModel();
model.put(TrustedHostClientRegistrationPolicyFactory.HOST_SENDING_REGISTRATION_REQUEST_MUST_MATCH, "true");