Merge pull request #3457 from mhajas/KEYCLOAK-3728
KEYCLOAK-3728 Test for turned off script based authenticators
This commit is contained in:
commit
136f3bc5f9
3 changed files with 41 additions and 5 deletions
|
@ -32,6 +32,8 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.keycloak.common.Profile.isPreviewEnabled;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
|
||||
*/
|
||||
|
@ -135,7 +137,9 @@ public class ProvidersTest extends AbstractAuthenticationTest {
|
|||
"Validates a OTP on a separate OTP form. Only shown if required based on the configured conditions.");
|
||||
addProviderInfo(result, "auth-cookie", "Cookie", "Validates the SSO cookie set by the auth server.");
|
||||
addProviderInfo(result, "auth-otp-form", "OTP Form", "Validates a OTP on a separate OTP form.");
|
||||
addProviderInfo(result, "auth-script-based", "Script", "Script based authentication. Allows to define custom authentication logic via JavaScript.");
|
||||
if (isPreviewEnabled()) {
|
||||
addProviderInfo(result, "auth-script-based", "Script", "Script based authentication. Allows to define custom authentication logic via JavaScript.");
|
||||
}
|
||||
addProviderInfo(result, "auth-spnego", "Kerberos", "Initiates the SPNEGO protocol. Most often used with Kerberos.");
|
||||
addProviderInfo(result, "auth-username-password-form", "Username Password Form",
|
||||
"Validates a username and password from login form.");
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package org.keycloak.testsuite.admin.authentication;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.testsuite.ProfileAssume;
|
||||
|
||||
import javax.ws.rs.BadRequestException;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author mhajas
|
||||
*/
|
||||
public class ScriptBasedAuthenticatorTest extends AbstractAuthenticationTest {
|
||||
|
||||
@Test
|
||||
public void checkIfTurnedOffWithProductProfile() throws InterruptedException {
|
||||
ProfileAssume.assumePreviewDisabled();
|
||||
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
params.put("newName", "Copy-of-browser");
|
||||
authMgmtResource.copy("browser", params);
|
||||
|
||||
params.put("provider", "auth-script-based");
|
||||
try {
|
||||
authMgmtResource.addExecution("Copy-of-browser", params);
|
||||
Assert.fail("Adding script based authenticator should fail with product profile");
|
||||
} catch (BadRequestException ex) {
|
||||
//Expected
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,10 +18,7 @@ package org.keycloak.testsuite.forms;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jboss.arquillian.graphene.page.Page;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.*;
|
||||
import org.keycloak.authentication.authenticators.browser.ScriptBasedAuthenticatorFactory;
|
||||
import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
|
||||
import org.keycloak.events.Details;
|
||||
|
@ -34,6 +31,7 @@ import org.keycloak.representations.idm.AuthenticatorConfigRepresentation;
|
|||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.representations.idm.UserRepresentation;
|
||||
import org.keycloak.testsuite.AssertEvents;
|
||||
import org.keycloak.testsuite.ProfileAssume;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.util.ExecutionBuilder;
|
||||
import org.keycloak.testsuite.util.FlowBuilder;
|
||||
|
@ -62,6 +60,9 @@ public class ScriptAuthenticatorTest extends AbstractFlowTest {
|
|||
|
||||
private AuthenticationFlowRepresentation flow;
|
||||
|
||||
@BeforeClass
|
||||
public static void enabled() { ProfileAssume.assumePreview(); }
|
||||
|
||||
@Override
|
||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue