KEYCLOAK-12167 Remove need for Arquillian deployment to load test classes
This commit is contained in:
parent
b2664c7ef9
commit
30e024a3c9
106 changed files with 580 additions and 1665 deletions
|
@ -0,0 +1,27 @@
|
||||||
|
package org.keycloak.testsuite.rest;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLClassLoader;
|
||||||
|
|
||||||
|
public class TestClassLoader extends URLClassLoader {
|
||||||
|
|
||||||
|
private static TestClassLoader instance;
|
||||||
|
|
||||||
|
public static TestClassLoader getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
ClassLoader parent = TestClassLoader.class.getClassLoader();
|
||||||
|
try {
|
||||||
|
instance = new TestClassLoader(parent);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TestClassLoader(ClassLoader parent) throws MalformedURLException {
|
||||||
|
super(new URL[] { new URL("http://localhost:8500/") }, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -18,10 +18,8 @@
|
||||||
package org.keycloak.testsuite.rest;
|
package org.keycloak.testsuite.rest;
|
||||||
|
|
||||||
import org.jboss.resteasy.annotations.cache.NoCache;
|
import org.jboss.resteasy.annotations.cache.NoCache;
|
||||||
import javax.ws.rs.BadRequestException;
|
|
||||||
import org.jboss.resteasy.spi.HttpRequest;
|
import org.jboss.resteasy.spi.HttpRequest;
|
||||||
import org.keycloak.common.Profile;
|
import org.keycloak.common.Profile;
|
||||||
import org.keycloak.common.util.Base64Url;
|
|
||||||
import org.keycloak.common.util.HtmlUtils;
|
import org.keycloak.common.util.HtmlUtils;
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
|
@ -33,7 +31,6 @@ import org.keycloak.events.admin.AdminEvent;
|
||||||
import org.keycloak.events.admin.AdminEventQuery;
|
import org.keycloak.events.admin.AdminEventQuery;
|
||||||
import org.keycloak.events.admin.AuthDetails;
|
import org.keycloak.events.admin.AuthDetails;
|
||||||
import org.keycloak.events.admin.OperationType;
|
import org.keycloak.events.admin.OperationType;
|
||||||
import org.keycloak.events.admin.ResourceType;
|
|
||||||
import org.keycloak.models.AuthenticationFlowModel;
|
import org.keycloak.models.AuthenticationFlowModel;
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.ClientScopeModel;
|
import org.keycloak.models.ClientScopeModel;
|
||||||
|
@ -73,7 +70,6 @@ import org.keycloak.testsuite.rest.resource.TestCacheResource;
|
||||||
import org.keycloak.testsuite.rest.resource.TestJavascriptResource;
|
import org.keycloak.testsuite.rest.resource.TestJavascriptResource;
|
||||||
import org.keycloak.testsuite.rest.resource.TestLDAPResource;
|
import org.keycloak.testsuite.rest.resource.TestLDAPResource;
|
||||||
import org.keycloak.testsuite.rest.resource.TestingExportImportResource;
|
import org.keycloak.testsuite.rest.resource.TestingExportImportResource;
|
||||||
import org.keycloak.testsuite.runonserver.ModuleUtil;
|
|
||||||
import org.keycloak.testsuite.runonserver.FetchOnServer;
|
import org.keycloak.testsuite.runonserver.FetchOnServer;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServer;
|
import org.keycloak.testsuite.runonserver.RunOnServer;
|
||||||
import org.keycloak.testsuite.runonserver.SerializationUtil;
|
import org.keycloak.testsuite.runonserver.SerializationUtil;
|
||||||
|
@ -81,6 +77,7 @@ import org.keycloak.timer.TimerProvider;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
import org.keycloak.utils.MediaType;
|
import org.keycloak.utils.MediaType;
|
||||||
|
|
||||||
|
import javax.ws.rs.BadRequestException;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.NotFoundException;
|
import javax.ws.rs.NotFoundException;
|
||||||
|
@ -93,14 +90,12 @@ import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.Cookie;
|
import javax.ws.rs.core.Cookie;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URI;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -790,8 +785,7 @@ public class TestingResourceProvider implements RealmResourceProvider {
|
||||||
@Produces(MediaType.TEXT_PLAIN_UTF_8)
|
@Produces(MediaType.TEXT_PLAIN_UTF_8)
|
||||||
public String runOnServer(String runOnServer) throws Exception {
|
public String runOnServer(String runOnServer) throws Exception {
|
||||||
try {
|
try {
|
||||||
ClassLoader cl = ModuleUtil.isModules() ? ModuleUtil.getClassLoader() : getClass().getClassLoader();
|
Object r = SerializationUtil.decode(runOnServer, TestClassLoader.getInstance());
|
||||||
Object r = SerializationUtil.decode(runOnServer, cl);
|
|
||||||
|
|
||||||
if (r instanceof FetchOnServer) {
|
if (r instanceof FetchOnServer) {
|
||||||
Object result = ((FetchOnServer) r).run(session);
|
Object result = ((FetchOnServer) r).run(session);
|
||||||
|
@ -815,9 +809,7 @@ public class TestingResourceProvider implements RealmResourceProvider {
|
||||||
public String runModelTestOnServer(@QueryParam("testClassName") String testClassName,
|
public String runModelTestOnServer(@QueryParam("testClassName") String testClassName,
|
||||||
@QueryParam("testMethodName") String testMethodName) throws Exception {
|
@QueryParam("testMethodName") String testMethodName) throws Exception {
|
||||||
try {
|
try {
|
||||||
ClassLoader cl = ModuleUtil.isModules() ? ModuleUtil.getClassLoader() : getClass().getClassLoader();
|
Class testClass = TestClassLoader.getInstance().loadClass(testClassName);
|
||||||
|
|
||||||
Class testClass = cl.loadClass(testClassName);
|
|
||||||
Method testMethod = testClass.getDeclaredMethod(testMethodName, KeycloakSession.class);
|
Method testMethod = testClass.getDeclaredMethod(testMethodName, KeycloakSession.class);
|
||||||
|
|
||||||
Object test = testClass.newInstance();
|
Object test = testClass.newInstance();
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
package org.keycloak.testsuite.runonserver;
|
|
||||||
|
|
||||||
import org.jboss.modules.Module;
|
|
||||||
import org.jboss.modules.ModuleIdentifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by st on 26.01.17.
|
|
||||||
*/
|
|
||||||
public class ModuleUtil {
|
|
||||||
|
|
||||||
private static boolean modules;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
Module.getContextModuleLoader().loadModule(ModuleIdentifier.fromString("org.wildfly.common"));
|
|
||||||
modules = true;
|
|
||||||
} catch (Throwable t) {
|
|
||||||
modules = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isModules() {
|
|
||||||
return modules;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ClassLoader getClassLoader() {
|
|
||||||
try {
|
|
||||||
Module m = Module.getContextModuleLoader().loadModule(ModuleIdentifier.fromString("deployment.run-on-server-classes.war"));
|
|
||||||
return m.getClassLoader();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to load 'deployment.run-on-server-classes.war', did you include RunOnServerDeployment?", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,9 +1,15 @@
|
||||||
package org.keycloak.testsuite.runonserver;
|
package org.keycloak.testsuite.runonserver;
|
||||||
|
|
||||||
|
import org.keycloak.credential.CredentialModel;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.ModelToRepresentation;
|
import org.keycloak.models.utils.ModelToRepresentation;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
|
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by st on 26.01.17.
|
* Created by st on 26.01.17.
|
||||||
*/
|
*/
|
||||||
|
@ -41,4 +47,25 @@ public class RunHelpers {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FetchOnServerWrapper<CredentialModel> fetchCredentials(String username) {
|
||||||
|
return new FetchOnServerWrapper() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FetchOnServer getRunOnServer() {
|
||||||
|
return (FetchOnServer) session -> {
|
||||||
|
RealmModel realm = session.getContext().getRealm();
|
||||||
|
UserModel user = session.users().getUserByUsername(username, realm);
|
||||||
|
List<CredentialModel> storedCredentialsByType = session.userCredentialManager().getStoredCredentialsByType(realm, user, CredentialRepresentation.PASSWORD);
|
||||||
|
System.out.println(storedCredentialsByType.size());
|
||||||
|
return storedCredentialsByType.get(0);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class getResultClass() {
|
||||||
|
return CredentialModel.class;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,6 +544,10 @@ public class AuthServerTestEnricher {
|
||||||
suiteContext.getServerLogChecker().updateLastCheckedPositionsOfAllFilesToEndOfFile();
|
suiteContext.getServerLogChecker().updateLastCheckedPositionsOfAllFilesToEndOfFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startTestClassProvider(@Observes(precedence = 100) BeforeSuite beforeSuite) {
|
||||||
|
new TestClassProvider().start();
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern UNEXPECTED_UNCAUGHT_ERROR = Pattern.compile(
|
private static final Pattern UNEXPECTED_UNCAUGHT_ERROR = Pattern.compile(
|
||||||
KeycloakErrorHandler.class.getSimpleName()
|
KeycloakErrorHandler.class.getSimpleName()
|
||||||
+ ".*"
|
+ ".*"
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package org.keycloak.testsuite.arquillian;
|
||||||
|
|
||||||
|
import io.undertow.Handlers;
|
||||||
|
import io.undertow.Undertow;
|
||||||
|
import io.undertow.UndertowMessages;
|
||||||
|
import io.undertow.server.handlers.resource.Resource;
|
||||||
|
import io.undertow.server.handlers.resource.ResourceChangeListener;
|
||||||
|
import io.undertow.server.handlers.resource.ResourceManager;
|
||||||
|
import io.undertow.server.handlers.resource.URLResource;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
public class TestClassProvider {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TestClassProvider.class);
|
||||||
|
|
||||||
|
public static final String[] PERMITTED_PACKAGES = new String[] {
|
||||||
|
"/org/keycloak/testsuite",
|
||||||
|
"/org/junit",
|
||||||
|
"/org/hamcrest",
|
||||||
|
"/org/keycloak/admin/client",
|
||||||
|
"/org/jboss/resteasy/client",
|
||||||
|
"/org/jboss/arquillian",
|
||||||
|
"/org/jboss/shrinkwrap",
|
||||||
|
"/org/openqa/selenium"
|
||||||
|
};
|
||||||
|
|
||||||
|
private Undertow server;
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
server = Undertow.builder()
|
||||||
|
.addHttpListener(8500, "localhost")
|
||||||
|
.setHandler(Handlers.resource(new ClassPathResourceManager()))
|
||||||
|
.build();
|
||||||
|
server.start();
|
||||||
|
|
||||||
|
LOGGER.infov("Started test class provider on http://localhost:8500");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
server.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClassPathResourceManager implements ResourceManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Resource getResource(String className) {
|
||||||
|
LOGGER.infov("Request: {0}", className);
|
||||||
|
|
||||||
|
URL resource = isPermittedPackage(className) ? TestClassProvider.class.getResource(className) : null;
|
||||||
|
return resource != null ? new URLResource(resource, className) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPermittedPackage(String className) {
|
||||||
|
for (String p : PERMITTED_PACKAGES) {
|
||||||
|
if (className.startsWith(p)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isResourceChangeListenerSupported() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerResourceChangeListener(ResourceChangeListener listener) {
|
||||||
|
throw UndertowMessages.MESSAGES.resourceChangeListenerNotSupported();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeResourceChangeListener(ResourceChangeListener listener) {
|
||||||
|
throw UndertowMessages.MESSAGES.resourceChangeListenerNotSupported();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -93,6 +93,13 @@ public class KeycloakTestingClient implements AutoCloseable {
|
||||||
|
|
||||||
public TestExampleCompanyResource testExampleCompany() { return target.proxy(TestExampleCompanyResource.class); }
|
public TestExampleCompanyResource testExampleCompany() { return target.proxy(TestExampleCompanyResource.class); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows running code on the server-side for white-box testing. When using be careful what imports your test class
|
||||||
|
* has and also what classes are used within the function sent to the server. Classes have to be either available
|
||||||
|
* server-side or defined in @{@link org.keycloak.testsuite.arquillian.TestClassProvider#PERMITTED_PACKAGES}
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Server server() {
|
public Server server() {
|
||||||
return new Server("master");
|
return new Server("master");
|
||||||
}
|
}
|
||||||
|
@ -152,7 +159,6 @@ public class KeycloakTestingClient implements AutoCloseable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void runModelTest(String testClassName, String testMethodName) throws RunOnServerException {
|
public void runModelTest(String testClassName, String testMethodName) throws RunOnServerException {
|
||||||
String result = testing(realm != null ? realm : "master").runModelTestOnServer(testClassName, testMethodName);
|
String result = testing(realm != null ? realm : "master").runModelTestOnServer(testClassName, testMethodName);
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,11 @@ public class MailUtils {
|
||||||
throw new AssertionError("No link found in " + body);
|
throw new AssertionError("No link found in " + body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPasswordResetEmailLink(MimeMessage message) throws IOException, MessagingException {
|
public static String getPasswordResetEmailLink(MimeMessage message) throws IOException {
|
||||||
return getPasswordResetEmailLink(new EmailBody(message));
|
return getPasswordResetEmailLink(new EmailBody(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPasswordResetEmailLink(EmailBody body) throws IOException, MessagingException {
|
public static String getPasswordResetEmailLink(EmailBody body) throws IOException {
|
||||||
final String textChangePwdUrl = getLink(body.getText());
|
final String textChangePwdUrl = getLink(body.getText());
|
||||||
String htmlChangePwdUrl = getLink(body.getHtml());
|
String htmlChangePwdUrl = getLink(body.getHtml());
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class MailUtils {
|
||||||
return htmlChangePwdUrl;
|
return htmlChangePwdUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EmailBody getBody(MimeMessage message) throws IOException, MessagingException {
|
public static EmailBody getBody(MimeMessage message) throws IOException {
|
||||||
return new EmailBody(message);
|
return new EmailBody(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,20 +68,24 @@ public class MailUtils {
|
||||||
private String text;
|
private String text;
|
||||||
private String html;
|
private String html;
|
||||||
|
|
||||||
private EmailBody(MimeMessage message) throws IOException, MessagingException {
|
private EmailBody(MimeMessage message) throws IOException {
|
||||||
Multipart multipart = (Multipart) message.getContent();
|
try {
|
||||||
|
Multipart multipart = (Multipart) message.getContent();
|
||||||
|
|
||||||
String textContentType = multipart.getBodyPart(0).getContentType();
|
String textContentType = multipart.getBodyPart(0).getContentType();
|
||||||
|
|
||||||
assertEquals("text/plain; charset=UTF-8", textContentType);
|
assertEquals("text/plain; charset=UTF-8", textContentType);
|
||||||
|
|
||||||
text = (String) multipart.getBodyPart(0).getContent();
|
text = (String) multipart.getBodyPart(0).getContent();
|
||||||
|
|
||||||
String htmlContentType = multipart.getBodyPart(1).getContentType();
|
String htmlContentType = multipart.getBodyPart(1).getContentType();
|
||||||
|
|
||||||
assertEquals("text/html; charset=UTF-8", htmlContentType);
|
assertEquals("text/html; charset=UTF-8", htmlContentType);
|
||||||
|
|
||||||
html = (String) multipart.getBodyPart(1).getContent();
|
html = (String) multipart.getBodyPart(1).getContent();
|
||||||
|
} catch (MessagingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.TokenVerifier;
|
import org.keycloak.TokenVerifier;
|
||||||
import org.keycloak.broker.provider.util.SimpleHttp;
|
import org.keycloak.broker.provider.util.SimpleHttp;
|
||||||
import org.keycloak.common.VerificationException;
|
import org.keycloak.common.VerificationException;
|
||||||
import org.keycloak.common.util.KeyUtils;
|
|
||||||
import org.keycloak.common.util.KeystoreUtil;
|
import org.keycloak.common.util.KeystoreUtil;
|
||||||
import org.keycloak.constants.AdapterConstants;
|
import org.keycloak.constants.AdapterConstants;
|
||||||
import org.keycloak.crypto.Algorithm;
|
import org.keycloak.crypto.Algorithm;
|
||||||
|
@ -51,7 +50,6 @@ import org.keycloak.crypto.SignatureSignerContext;
|
||||||
import org.keycloak.jose.jwk.JSONWebKeySet;
|
import org.keycloak.jose.jwk.JSONWebKeySet;
|
||||||
import org.keycloak.jose.jwk.JWK;
|
import org.keycloak.jose.jwk.JWK;
|
||||||
import org.keycloak.jose.jwk.JWKParser;
|
import org.keycloak.jose.jwk.JWKParser;
|
||||||
import org.keycloak.jose.jws.JWSBuilder;
|
|
||||||
import org.keycloak.jose.jws.JWSInput;
|
import org.keycloak.jose.jws.JWSInput;
|
||||||
import org.keycloak.models.Constants;
|
import org.keycloak.models.Constants;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
|
@ -80,7 +78,6 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.keycloak.admin.client.resource.AuthenticationManagementResource;
|
||||||
import org.keycloak.admin.client.resource.RealmsResource;
|
import org.keycloak.admin.client.resource.RealmsResource;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.admin.client.resource.UserResource;
|
||||||
import org.keycloak.admin.client.resource.UsersResource;
|
import org.keycloak.admin.client.resource.UsersResource;
|
||||||
import org.keycloak.common.Profile;
|
|
||||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
|
|
|
@ -18,11 +18,9 @@ package org.keycloak.testsuite.adapter.servlet;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
|
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -54,25 +52,21 @@ import org.keycloak.representations.idm.authorization.ClientPolicyRepresentation
|
||||||
import org.keycloak.representations.idm.authorization.DecisionStrategy;
|
import org.keycloak.representations.idm.authorization.DecisionStrategy;
|
||||||
import org.keycloak.services.resources.admin.permissions.AdminPermissionManagement;
|
import org.keycloak.services.resources.admin.permissions.AdminPermissionManagement;
|
||||||
import org.keycloak.services.resources.admin.permissions.AdminPermissions;
|
import org.keycloak.services.resources.admin.permissions.AdminPermissions;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
|
||||||
import org.keycloak.testsuite.ProfileAssume;
|
|
||||||
import org.keycloak.testsuite.adapter.AbstractAdapterTest;
|
|
||||||
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.DisableFeature;
|
import org.keycloak.testsuite.arquillian.annotation.DisableFeature;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;
|
import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;
|
||||||
import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
|
|
||||||
import org.keycloak.testsuite.broker.BrokerTestTools;
|
import org.keycloak.testsuite.broker.BrokerTestTools;
|
||||||
import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl;
|
import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl;
|
||||||
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
|
||||||
import org.keycloak.testsuite.util.ContainerAssume;
|
import org.keycloak.testsuite.util.ContainerAssume;
|
||||||
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.testsuite.util.WaitUtils;
|
import org.keycloak.testsuite.util.WaitUtils;
|
||||||
|
import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
|
||||||
import org.keycloak.util.BasicAuthHelper;
|
import org.keycloak.util.BasicAuthHelper;
|
||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
|
@ -88,9 +82,7 @@ import java.net.URL;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.Assert.assertEquals;
|
|
||||||
import static org.keycloak.testsuite.admin.ApiUtil.createUserAndResetPasswordWithAdminClient;
|
import static org.keycloak.testsuite.admin.ApiUtil.createUserAndResetPasswordWithAdminClient;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
@ -111,15 +103,6 @@ public class BrokerLinkAndTokenExchangeTest extends AbstractServletsAdapterTest
|
||||||
public static final String UNAUTHORIZED_CHILD_CLIENT = "unauthorized-child-client";
|
public static final String UNAUTHORIZED_CHILD_CLIENT = "unauthorized-child-client";
|
||||||
public static final String PARENT_CLIENT = "parent-client";
|
public static final String PARENT_CLIENT = "parent-client";
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(BrokerLinkAndTokenExchangeTest.class,
|
|
||||||
AbstractServletsAdapterTest.class,
|
|
||||||
AbstractAdapterTest.class,
|
|
||||||
AbstractAuthTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deployment(name = ClientApp.DEPLOYMENT_NAME)
|
@Deployment(name = ClientApp.DEPLOYMENT_NAME)
|
||||||
protected static WebArchive accountLink() {
|
protected static WebArchive accountLink() {
|
||||||
return servletDeployment(ClientApp.DEPLOYMENT_NAME, LinkAndExchangeServlet.class, ServletTestUtils.class);
|
return servletDeployment(ClientApp.DEPLOYMENT_NAME, LinkAndExchangeServlet.class, ServletTestUtils.class);
|
||||||
|
|
|
@ -16,15 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.adapter.servlet;
|
package org.keycloak.testsuite.adapter.servlet;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -44,20 +36,23 @@ import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.storage.UserStorageProvider;
|
import org.keycloak.storage.UserStorageProvider;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
|
||||||
import org.keycloak.testsuite.adapter.AbstractAdapterTest;
|
|
||||||
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
||||||
import org.keycloak.testsuite.adapter.page.ProductPortal;
|
import org.keycloak.testsuite.adapter.page.ProductPortal;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||||
import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
|
|
||||||
import org.keycloak.testsuite.auth.page.login.PageWithLoginUrl;
|
|
||||||
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
||||||
import org.keycloak.testsuite.pages.ConsentPage;
|
import org.keycloak.testsuite.pages.ConsentPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
import org.keycloak.testsuite.utils.arquillian.ContainerConstants;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
|
||||||
|
|
||||||
|
@ -79,16 +74,6 @@ public class UserStorageConsentTest extends AbstractServletsAdapterTest {
|
||||||
@Page
|
@Page
|
||||||
protected ConsentPage consentPage;
|
protected ConsentPage consentPage;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
AbstractServletsAdapterTest.class,
|
|
||||||
AbstractAdapterTest.class,
|
|
||||||
AbstractAuthTest.class,
|
|
||||||
PageWithLoginUrl.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deployment(name = ProductPortal.DEPLOYMENT_NAME)
|
@Deployment(name = ProductPortal.DEPLOYMENT_NAME)
|
||||||
protected static WebArchive productPortal() {
|
protected static WebArchive productPortal() {
|
||||||
return servletDeployment(ProductPortal.DEPLOYMENT_NAME, ProductServlet.class);
|
return servletDeployment(ProductPortal.DEPLOYMENT_NAME, ProductServlet.class);
|
||||||
|
|
|
@ -16,13 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.admin;
|
package org.keycloak.testsuite.admin;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.TEST;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.ClientsResource;
|
import org.keycloak.admin.client.resource.ClientsResource;
|
||||||
import org.keycloak.authorization.AuthorizationProvider;
|
import org.keycloak.authorization.AuthorizationProvider;
|
||||||
|
@ -38,23 +31,20 @@ import org.keycloak.representations.idm.authorization.Logic;
|
||||||
import org.keycloak.representations.idm.authorization.ResourceServerRepresentation;
|
import org.keycloak.representations.idm.authorization.ResourceServerRepresentation;
|
||||||
import org.keycloak.representations.idm.authorization.RolePolicyRepresentation;
|
import org.keycloak.representations.idm.authorization.RolePolicyRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.ProfileAssume;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientBuilder;
|
import org.keycloak.testsuite.util.ClientBuilder;
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.keycloak.testsuite.auth.page.AuthRealm.TEST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
*/
|
*/
|
||||||
public class AuthzCleanupTest extends AbstractKeycloakTest {
|
public class AuthzCleanupTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
testRealms.add(RealmBuilder.create().name(TEST)
|
testRealms.add(RealmBuilder.create().name(TEST)
|
||||||
|
|
|
@ -17,48 +17,49 @@
|
||||||
package org.keycloak.testsuite.admin;
|
package org.keycloak.testsuite.admin;
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.Keycloak;
|
import org.keycloak.admin.client.Keycloak;
|
||||||
import org.keycloak.authorization.AuthorizationProvider;
|
import org.keycloak.authorization.AuthorizationProvider;
|
||||||
|
import org.keycloak.authorization.model.Policy;
|
||||||
import org.keycloak.authorization.model.Resource;
|
import org.keycloak.authorization.model.Resource;
|
||||||
|
import org.keycloak.authorization.model.ResourceServer;
|
||||||
import org.keycloak.client.admin.cli.util.ConfigUtil;
|
import org.keycloak.client.admin.cli.util.ConfigUtil;
|
||||||
import org.keycloak.common.Profile;
|
import org.keycloak.common.Profile;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.AdminRoles;
|
||||||
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.Constants;
|
||||||
|
import org.keycloak.models.GroupModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RoleModel;
|
||||||
|
import org.keycloak.models.UserCredentialModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.models.utils.RepresentationToModel;
|
import org.keycloak.models.utils.RepresentationToModel;
|
||||||
import org.keycloak.representations.idm.authorization.ClientPolicyRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.models.GroupModel;
|
|
||||||
import org.keycloak.representations.idm.ClientScopeRepresentation;
|
import org.keycloak.representations.idm.ClientScopeRepresentation;
|
||||||
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
|
import org.keycloak.representations.idm.authorization.ClientPolicyRepresentation;
|
||||||
|
import org.keycloak.representations.idm.authorization.DecisionStrategy;
|
||||||
import org.keycloak.representations.idm.authorization.Logic;
|
import org.keycloak.representations.idm.authorization.Logic;
|
||||||
import org.keycloak.representations.idm.authorization.UserPolicyRepresentation;
|
import org.keycloak.representations.idm.authorization.UserPolicyRepresentation;
|
||||||
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;
|
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;
|
||||||
import org.keycloak.services.resources.admin.permissions.AdminPermissionManagement;
|
import org.keycloak.services.resources.admin.permissions.AdminPermissionManagement;
|
||||||
import org.keycloak.services.resources.admin.permissions.AdminPermissions;
|
import org.keycloak.services.resources.admin.permissions.AdminPermissions;
|
||||||
import org.keycloak.authorization.model.Policy;
|
|
||||||
import org.keycloak.authorization.model.ResourceServer;
|
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
|
||||||
import org.keycloak.representations.idm.authorization.DecisionStrategy;
|
|
||||||
import org.keycloak.services.resources.admin.permissions.GroupPermissionManagement;
|
import org.keycloak.services.resources.admin.permissions.GroupPermissionManagement;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.ProfileAssume;
|
|
||||||
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;
|
import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;
|
||||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.AdminClientUtil;
|
import org.keycloak.testsuite.util.AdminClientUtil;
|
||||||
import org.keycloak.testsuite.utils.tls.TLSUtils;
|
import org.keycloak.testsuite.utils.tls.TLSUtils;
|
||||||
|
|
||||||
import javax.ws.rs.ClientErrorException;
|
import javax.ws.rs.ClientErrorException;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -73,11 +74,6 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
public static final String CLIENT_NAME = "application";
|
public static final String CLIENT_NAME = "application";
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(FineGrainAdminUnitTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
RealmRepresentation testRealmRep = new RealmRepresentation();
|
RealmRepresentation testRealmRep = new RealmRepresentation();
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.admin;
|
package org.keycloak.testsuite.admin;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.Keycloak;
|
import org.keycloak.admin.client.Keycloak;
|
||||||
|
@ -35,7 +33,6 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.AdminClientUtil;
|
import org.keycloak.testsuite.util.AdminClientUtil;
|
||||||
|
|
||||||
import javax.ws.rs.ClientErrorException;
|
import javax.ws.rs.ClientErrorException;
|
||||||
|
@ -55,11 +52,6 @@ public class IllegalAdminUpgradeTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
public static final String CLIENT_NAME = "application";
|
public static final String CLIENT_NAME = "application";
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(FineGrainAdminUnitTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
RealmRepresentation testRealmRep = new RealmRepresentation();
|
RealmRepresentation testRealmRep = new RealmRepresentation();
|
||||||
|
|
|
@ -17,11 +17,9 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.admin;
|
package org.keycloak.testsuite.admin;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
|
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
|
||||||
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
|
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Assume;
|
import org.junit.Assume;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -54,7 +52,6 @@ import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
||||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.AdminClientUtil;
|
import org.keycloak.testsuite.util.AdminClientUtil;
|
||||||
import org.keycloak.testsuite.util.ClientBuilder;
|
import org.keycloak.testsuite.util.ClientBuilder;
|
||||||
import org.keycloak.testsuite.util.CredentialBuilder;
|
import org.keycloak.testsuite.util.CredentialBuilder;
|
||||||
|
@ -112,12 +109,6 @@ public class ImpersonationTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
private String impersonatedUserId;
|
private String impersonatedUserId;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ImpersonationTest.class, AbstractKeycloakTest.class, UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite", "org.keycloak.admin.client", "org.openqa.selenium");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
RealmBuilder realm = RealmBuilder.create().name("test").testEventListener();
|
RealmBuilder realm = RealmBuilder.create().name("test").testEventListener();
|
||||||
|
|
|
@ -18,11 +18,9 @@
|
||||||
package org.keycloak.testsuite.admin;
|
package org.keycloak.testsuite.admin;
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.drone.api.annotation.Drone;
|
import org.jboss.arquillian.drone.api.annotation.Drone;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -54,8 +52,6 @@ import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.services.resources.RealmsResource;
|
import org.keycloak.services.resources.RealmsResource;
|
||||||
import org.keycloak.storage.UserStorageProvider;
|
import org.keycloak.storage.UserStorageProvider;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.federation.DummyUserFederationProvider;
|
|
||||||
import org.keycloak.testsuite.federation.DummyUserFederationProviderFactory;
|
import org.keycloak.testsuite.federation.DummyUserFederationProviderFactory;
|
||||||
import org.keycloak.testsuite.page.LoginPasswordUpdatePage;
|
import org.keycloak.testsuite.page.LoginPasswordUpdatePage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
|
@ -63,7 +59,7 @@ import org.keycloak.testsuite.pages.InfoPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.PageUtils;
|
import org.keycloak.testsuite.pages.PageUtils;
|
||||||
import org.keycloak.testsuite.pages.ProceedPage;
|
import org.keycloak.testsuite.pages.ProceedPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
import org.keycloak.testsuite.runonserver.RunHelpers;
|
||||||
import org.keycloak.testsuite.util.AdminEventPaths;
|
import org.keycloak.testsuite.util.AdminEventPaths;
|
||||||
import org.keycloak.testsuite.util.ClientBuilder;
|
import org.keycloak.testsuite.util.ClientBuilder;
|
||||||
import org.keycloak.testsuite.util.GreenMailRule;
|
import org.keycloak.testsuite.util.GreenMailRule;
|
||||||
|
@ -76,7 +72,6 @@ import org.keycloak.util.JsonSerialization;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import javax.ws.rs.ClientErrorException;
|
import javax.ws.rs.ClientErrorException;
|
||||||
import javax.ws.rs.NotFoundException;
|
import javax.ws.rs.NotFoundException;
|
||||||
|
@ -130,15 +125,6 @@ public class UserTest extends AbstractAdminTest {
|
||||||
@Page
|
@Page
|
||||||
protected LoginPage loginPage;
|
protected LoginPage loginPage;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
AbstractAdminTest.class,
|
|
||||||
AbstractTestRealmKeycloakTest.class,
|
|
||||||
DummyUserFederationProviderFactory.class, DummyUserFederationProvider.class,
|
|
||||||
UserResource.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String createUser() {
|
public String createUser() {
|
||||||
return createUser("user1", "user1@localhost");
|
return createUser("user1", "user1@localhost");
|
||||||
}
|
}
|
||||||
|
@ -349,13 +335,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CredentialModel fetchCredentials(String username) {
|
private CredentialModel fetchCredentials(String username) {
|
||||||
return getTestingClient().server(REALM_NAME).fetch(session -> {
|
return getTestingClient().server(REALM_NAME).fetch(RunHelpers.fetchCredentials(username));
|
||||||
RealmModel realm = session.getContext().getRealm();
|
|
||||||
UserModel user = session.users().getUserByUsername(username, realm);
|
|
||||||
List<CredentialModel> storedCredentialsByType = session.userCredentialManager().getStoredCredentialsByType(realm, user, CredentialRepresentation.PASSWORD);
|
|
||||||
System.out.println(storedCredentialsByType.size());
|
|
||||||
return storedCredentialsByType.get(0);
|
|
||||||
}, CredentialModel.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -784,7 +764,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendResetPasswordEmailSuccess() throws IOException, MessagingException {
|
public void sendResetPasswordEmailSuccess() throws IOException {
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setEnabled(true);
|
userRep.setEnabled(true);
|
||||||
userRep.setUsername("user1");
|
userRep.setUsername("user1");
|
||||||
|
@ -831,7 +811,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendResetPasswordEmailSuccessTwoLinks() throws IOException, MessagingException {
|
public void sendResetPasswordEmailSuccessTwoLinks() throws IOException {
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setEnabled(true);
|
userRep.setEnabled(true);
|
||||||
userRep.setUsername("user1");
|
userRep.setUsername("user1");
|
||||||
|
@ -874,7 +854,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendResetPasswordEmailSuccessTwoLinksReverse() throws IOException, MessagingException {
|
public void sendResetPasswordEmailSuccessTwoLinksReverse() throws IOException {
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setEnabled(true);
|
userRep.setEnabled(true);
|
||||||
userRep.setUsername("user1");
|
userRep.setUsername("user1");
|
||||||
|
@ -919,7 +899,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendResetPasswordEmailSuccessLinkOpenDoesNotExpireWhenOpenedOnly() throws IOException, MessagingException {
|
public void sendResetPasswordEmailSuccessLinkOpenDoesNotExpireWhenOpenedOnly() throws IOException {
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setEnabled(true);
|
userRep.setEnabled(true);
|
||||||
userRep.setUsername("user1");
|
userRep.setUsername("user1");
|
||||||
|
@ -962,7 +942,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendResetPasswordEmailSuccessTokenShortLifespan() throws IOException, MessagingException {
|
public void sendResetPasswordEmailSuccessTokenShortLifespan() throws IOException {
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setEnabled(true);
|
userRep.setEnabled(true);
|
||||||
userRep.setUsername("user1");
|
userRep.setUsername("user1");
|
||||||
|
@ -1004,7 +984,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendResetPasswordEmailSuccessWithRecycledAuthSession() throws IOException, MessagingException {
|
public void sendResetPasswordEmailSuccessWithRecycledAuthSession() throws IOException {
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setEnabled(true);
|
userRep.setEnabled(true);
|
||||||
userRep.setUsername("user1");
|
userRep.setUsername("user1");
|
||||||
|
@ -1068,7 +1048,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendResetPasswordEmailWithRedirect() throws IOException, MessagingException {
|
public void sendResetPasswordEmailWithRedirect() throws IOException {
|
||||||
|
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setEnabled(true);
|
userRep.setEnabled(true);
|
||||||
|
@ -1137,7 +1117,7 @@ public class UserTest extends AbstractAdminTest {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendVerifyEmail() throws IOException, MessagingException {
|
public void sendVerifyEmail() throws IOException {
|
||||||
UserRepresentation userRep = new UserRepresentation();
|
UserRepresentation userRep = new UserRepresentation();
|
||||||
userRep.setUsername("user1");
|
userRep.setUsername("user1");
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.keycloak.testsuite.admin.realm;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
@ -28,8 +26,10 @@ import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.Keycloak;
|
import org.keycloak.admin.client.Keycloak;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
|
import org.keycloak.events.EventType;
|
||||||
import org.keycloak.events.admin.OperationType;
|
import org.keycloak.events.admin.OperationType;
|
||||||
import org.keycloak.events.admin.ResourceType;
|
import org.keycloak.events.admin.ResourceType;
|
||||||
|
import org.keycloak.events.log.JBossLoggingEventListenerProviderFactory;
|
||||||
import org.keycloak.models.Constants;
|
import org.keycloak.models.Constants;
|
||||||
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.protocol.saml.SamlProtocol;
|
import org.keycloak.protocol.saml.SamlProtocol;
|
||||||
|
@ -39,6 +39,7 @@ import org.keycloak.representations.idm.AdminEventRepresentation;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.representations.idm.EventRepresentation;
|
import org.keycloak.representations.idm.EventRepresentation;
|
||||||
|
import org.keycloak.representations.idm.RealmEventsConfigRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
|
@ -49,8 +50,9 @@ import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
||||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
import org.keycloak.testsuite.events.EventsListenerProviderFactory;
|
||||||
import org.keycloak.testsuite.runonserver.RunHelpers;
|
import org.keycloak.testsuite.runonserver.RunHelpers;
|
||||||
|
import org.keycloak.testsuite.updaters.Creator;
|
||||||
import org.keycloak.testsuite.util.AdminEventPaths;
|
import org.keycloak.testsuite.util.AdminEventPaths;
|
||||||
import org.keycloak.testsuite.util.ClientBuilder;
|
import org.keycloak.testsuite.util.ClientBuilder;
|
||||||
import org.keycloak.testsuite.util.CredentialBuilder;
|
import org.keycloak.testsuite.util.CredentialBuilder;
|
||||||
|
@ -60,6 +62,7 @@ import org.keycloak.testsuite.util.UserBuilder;
|
||||||
import org.keycloak.testsuite.utils.tls.TLSUtils;
|
import org.keycloak.testsuite.utils.tls.TLSUtils;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
|
import javax.ws.rs.BadRequestException;
|
||||||
import javax.ws.rs.NotFoundException;
|
import javax.ws.rs.NotFoundException;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -71,26 +74,21 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.ws.rs.BadRequestException;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.keycloak.events.EventType;
|
import static org.junit.Assert.assertFalse;
|
||||||
import org.keycloak.events.log.JBossLoggingEventListenerProviderFactory;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import org.keycloak.representations.idm.RealmEventsConfigRepresentation;
|
import static org.junit.Assert.assertNull;
|
||||||
import org.keycloak.testsuite.events.EventsListenerProviderFactory;
|
import static org.junit.Assert.assertThat;
|
||||||
import org.keycloak.testsuite.updaters.Creator;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||||
*/
|
*/
|
||||||
public class RealmTest extends AbstractAdminTest {
|
public class RealmTest extends AbstractAdminTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public AssertEvents events = new AssertEvents(this);
|
public AssertEvents events = new AssertEvents(this);
|
||||||
@Rule
|
@Rule
|
||||||
|
|
|
@ -17,21 +17,14 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.admin.user;
|
package org.keycloak.testsuite.admin.user;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.events.admin.OperationType;
|
import org.keycloak.events.admin.OperationType;
|
||||||
import org.keycloak.events.admin.ResourceType;
|
import org.keycloak.events.admin.ResourceType;
|
||||||
import org.keycloak.representations.idm.GroupRepresentation;
|
import org.keycloak.representations.idm.GroupRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.admin.AbstractAdminTest;
|
import org.keycloak.testsuite.admin.AbstractAdminTest;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.federation.DummyUserFederationProvider;
|
|
||||||
import org.keycloak.testsuite.federation.DummyUserFederationProviderFactory;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.AdminEventPaths;
|
import org.keycloak.testsuite.util.AdminEventPaths;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
|
@ -48,15 +41,6 @@ import static org.keycloak.testsuite.Assert.assertNames;
|
||||||
*/
|
*/
|
||||||
public class UserGroupMembershipTest extends AbstractAdminTest {
|
public class UserGroupMembershipTest extends AbstractAdminTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
AbstractAdminTest.class,
|
|
||||||
AbstractTestRealmKeycloakTest.class,
|
|
||||||
DummyUserFederationProviderFactory.class, DummyUserFederationProvider.class,
|
|
||||||
UserResource.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String createUser() {
|
public String createUser() {
|
||||||
return createUser("user1", "user1@localhost");
|
return createUser("user1", "user1@localhost");
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.authz;
|
package org.keycloak.testsuite.authz;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.authorization.AuthorizationProvider;
|
import org.keycloak.authorization.AuthorizationProvider;
|
||||||
|
@ -42,9 +39,6 @@ import org.keycloak.representations.idm.authorization.PolicyEvaluationRequest;
|
||||||
import org.keycloak.representations.idm.authorization.PolicyEvaluationResponse;
|
import org.keycloak.representations.idm.authorization.PolicyEvaluationResponse;
|
||||||
import org.keycloak.representations.idm.authorization.PolicyRepresentation;
|
import org.keycloak.representations.idm.authorization.PolicyRepresentation;
|
||||||
import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation;
|
import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.ProfileAssume;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -67,11 +61,6 @@ public class PolicyEvaluationCompositeRoleTest extends AbstractAuthzTest {
|
||||||
testRealms.add(testRealmRep);
|
testRealms.add(testRealmRep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(AbstractAuthzTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setup(KeycloakSession session) {
|
public static void setup(KeycloakSession session) {
|
||||||
RealmModel realm = session.realms().getRealmByName(TEST);
|
RealmModel realm = session.realms().getRealmByName(TEST);
|
||||||
|
|
||||||
|
|
|
@ -16,20 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.authz;
|
package org.keycloak.testsuite.authz;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.authorization.AuthorizationProvider;
|
import org.keycloak.authorization.AuthorizationProvider;
|
||||||
|
@ -64,7 +50,6 @@ import org.keycloak.representations.idm.authorization.Permission;
|
||||||
import org.keycloak.representations.idm.authorization.ResourcePermissionRepresentation;
|
import org.keycloak.representations.idm.authorization.ResourcePermissionRepresentation;
|
||||||
import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation;
|
import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation;
|
||||||
import org.keycloak.representations.idm.authorization.TimePolicyRepresentation;
|
import org.keycloak.representations.idm.authorization.TimePolicyRepresentation;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientBuilder;
|
import org.keycloak.testsuite.util.ClientBuilder;
|
||||||
import org.keycloak.testsuite.util.GroupBuilder;
|
import org.keycloak.testsuite.util.GroupBuilder;
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
|
@ -72,6 +57,18 @@ import org.keycloak.testsuite.util.RoleBuilder;
|
||||||
import org.keycloak.testsuite.util.RolesBuilder;
|
import org.keycloak.testsuite.util.RolesBuilder;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||||
*/
|
*/
|
||||||
|
@ -127,11 +124,6 @@ public class PolicyEvaluationTest extends AbstractAuthzTest {
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(AbstractAuthzTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckDateAndTime() {testingClient.server().run(PolicyEvaluationTest::testCheckDateAndTime);}
|
public void testCheckDateAndTime() {testingClient.server().run(PolicyEvaluationTest::testCheckDateAndTime);}
|
||||||
|
|
||||||
|
|
|
@ -17,21 +17,13 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.broker;
|
package org.keycloak.testsuite.broker;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.UriBuilder;
|
|
||||||
import javax.ws.rs.core.UriBuilderException;
|
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.hamcrest.Matchers;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
|
import org.keycloak.common.util.Retry;
|
||||||
import org.keycloak.models.utils.TimeBasedOTP;
|
import org.keycloak.models.utils.TimeBasedOTP;
|
||||||
import org.keycloak.protocol.saml.SamlProtocol;
|
import org.keycloak.protocol.saml.SamlProtocol;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
|
@ -40,8 +32,6 @@ import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.services.resources.RealmsResource;
|
import org.keycloak.services.resources.RealmsResource;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.common.util.Retry;
|
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
|
||||||
import org.keycloak.testsuite.pages.AccountApplicationsPage;
|
import org.keycloak.testsuite.pages.AccountApplicationsPage;
|
||||||
import org.keycloak.testsuite.pages.AccountFederatedIdentityPage;
|
import org.keycloak.testsuite.pages.AccountFederatedIdentityPage;
|
||||||
import org.keycloak.testsuite.pages.AccountPasswordPage;
|
import org.keycloak.testsuite.pages.AccountPasswordPage;
|
||||||
|
@ -58,12 +48,16 @@ import org.keycloak.testsuite.pages.OAuthGrantPage;
|
||||||
import org.keycloak.testsuite.pages.ProceedPage;
|
import org.keycloak.testsuite.pages.ProceedPage;
|
||||||
import org.keycloak.testsuite.pages.UpdateAccountInformationPage;
|
import org.keycloak.testsuite.pages.UpdateAccountInformationPage;
|
||||||
import org.keycloak.testsuite.pages.VerifyEmailPage;
|
import org.keycloak.testsuite.pages.VerifyEmailPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.FlowUtil;
|
|
||||||
import org.keycloak.testsuite.util.MailServer;
|
import org.keycloak.testsuite.util.MailServer;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
import org.openqa.selenium.TimeoutException;
|
import org.openqa.selenium.TimeoutException;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.UriBuilder;
|
||||||
|
import javax.ws.rs.core.UriBuilderException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.keycloak.testsuite.admin.ApiUtil.createUserWithAdminClient;
|
import static org.keycloak.testsuite.admin.ApiUtil.createUserWithAdminClient;
|
||||||
|
@ -187,11 +181,6 @@ public abstract class AbstractBaseBrokerTest extends AbstractKeycloakTest {
|
||||||
assertEquals(expected, adminClient.realm(bc.consumerRealmName()).users().get(userId).getFederatedIdentity().size());
|
assertEquals(expected, adminClient.realm(bc.consumerRealmName()).users().get(userId).getFederatedIdentity().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(BrokerRunOnServerUtil.class, FlowUtil.class, KeycloakTestingClient.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void logInAsUserInIDP() {
|
protected void logInAsUserInIDP() {
|
||||||
driver.navigate().to(getAccountUrl(bc.consumerRealmName()));
|
driver.navigate().to(getAccountUrl(bc.consumerRealmName()));
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.keycloak.testsuite.broker;
|
package org.keycloak.testsuite.broker;
|
||||||
|
|
||||||
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.keycloak.admin.client.resource.AuthenticationManagementResource;
|
import org.keycloak.admin.client.resource.AuthenticationManagementResource;
|
||||||
import org.keycloak.admin.client.resource.UsersResource;
|
import org.keycloak.admin.client.resource.UsersResource;
|
||||||
import org.keycloak.authentication.authenticators.broker.IdpCreateUserIfUniqueAuthenticatorFactory;
|
import org.keycloak.authentication.authenticators.broker.IdpCreateUserIfUniqueAuthenticatorFactory;
|
||||||
|
@ -22,8 +22,6 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.keycloak.models.utils.DefaultAuthenticationFlows.IDP_REVIEW_PROFILE_CONFIG_ALIAS;
|
import static org.keycloak.models.utils.DefaultAuthenticationFlows.IDP_REVIEW_PROFILE_CONFIG_ALIAS;
|
||||||
import static org.keycloak.testsuite.broker.BrokerTestTools.waitForPage;
|
import static org.keycloak.testsuite.broker.BrokerTestTools.waitForPage;
|
||||||
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains just few basic tests. This is good class to override if you're testing custom IDP configuration and you need
|
* Contains just few basic tests. This is good class to override if you're testing custom IDP configuration and you need
|
||||||
* to verify if login with IDP works as expected
|
* to verify if login with IDP works as expected
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package org.keycloak.testsuite.broker;
|
package org.keycloak.testsuite.broker;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.Graphene;
|
import org.jboss.arquillian.graphene.Graphene;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -34,17 +32,16 @@ import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.AbstractSocialLoginPage;
|
import org.keycloak.testsuite.pages.social.AbstractSocialLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.BitbucketLoginPage;
|
import org.keycloak.testsuite.pages.social.BitbucketLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.FacebookLoginPage;
|
import org.keycloak.testsuite.pages.social.FacebookLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.InstagramLoginPage;
|
|
||||||
import org.keycloak.testsuite.pages.social.GitHubLoginPage;
|
import org.keycloak.testsuite.pages.social.GitHubLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.GitLabLoginPage;
|
import org.keycloak.testsuite.pages.social.GitLabLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.GoogleLoginPage;
|
import org.keycloak.testsuite.pages.social.GoogleLoginPage;
|
||||||
|
import org.keycloak.testsuite.pages.social.InstagramLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.LinkedInLoginPage;
|
import org.keycloak.testsuite.pages.social.LinkedInLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.MicrosoftLoginPage;
|
import org.keycloak.testsuite.pages.social.MicrosoftLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.OpenShiftLoginPage;
|
import org.keycloak.testsuite.pages.social.OpenShiftLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.PayPalLoginPage;
|
import org.keycloak.testsuite.pages.social.PayPalLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.StackOverflowLoginPage;
|
import org.keycloak.testsuite.pages.social.StackOverflowLoginPage;
|
||||||
import org.keycloak.testsuite.pages.social.TwitterLoginPage;
|
import org.keycloak.testsuite.pages.social.TwitterLoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.IdentityProviderBuilder;
|
import org.keycloak.testsuite.util.IdentityProviderBuilder;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
|
@ -70,13 +67,13 @@ import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assume.assumeTrue;
|
import static org.junit.Assume.assumeTrue;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.BITBUCKET;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.BITBUCKET;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.FACEBOOK;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.FACEBOOK;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.INSTAGRAM;
|
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITHUB;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITHUB;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITHUB_PRIVATE_EMAIL;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITHUB_PRIVATE_EMAIL;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITLAB;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITLAB;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE_HOSTED_DOMAIN;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE_HOSTED_DOMAIN;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE_NON_MATCHING_HOSTED_DOMAIN;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE_NON_MATCHING_HOSTED_DOMAIN;
|
||||||
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.INSTAGRAM;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.LINKEDIN;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.LINKEDIN;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.MICROSOFT;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.MICROSOFT;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.OPENSHIFT;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.OPENSHIFT;
|
||||||
|
@ -149,11 +146,6 @@ public class SocialLoginTest extends AbstractKeycloakTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Provider currentTestProvider = null;
|
private Provider currentTestProvider = null;
|
||||||
private AbstractSocialLoginPage currentSocialLoginPage = null;
|
private AbstractSocialLoginPage currentSocialLoginPage = null;
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.cli;
|
package org.keycloak.testsuite.cli;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import javax.mail.internet.MimeMessage;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.authentication.requiredactions.TermsAndConditions;
|
import org.keycloak.authentication.requiredactions.TermsAndConditions;
|
||||||
import org.keycloak.authorization.model.Policy;
|
import org.keycloak.authorization.model.Policy;
|
||||||
import org.keycloak.authorization.model.ResourceServer;
|
import org.keycloak.authorization.model.ResourceServer;
|
||||||
|
@ -61,12 +51,17 @@ import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.actions.DummyRequiredActionFactory;
|
import org.keycloak.testsuite.actions.DummyRequiredActionFactory;
|
||||||
import org.keycloak.testsuite.authentication.PushButtonAuthenticatorFactory;
|
import org.keycloak.testsuite.authentication.PushButtonAuthenticatorFactory;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.GreenMailRule;
|
import org.keycloak.testsuite.util.GreenMailRule;
|
||||||
import org.keycloak.testsuite.util.MailUtils;
|
import org.keycloak.testsuite.util.MailUtils;
|
||||||
import org.keycloak.utils.TotpUtils;
|
import org.keycloak.utils.TotpUtils;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
|
||||||
|
import javax.mail.internet.MimeMessage;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that clients can override auth flows
|
* Test that clients can override auth flows
|
||||||
*
|
*
|
||||||
|
@ -87,13 +82,6 @@ public class KcinitTest extends AbstractTestRealmKeycloakTest {
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setupFlows() {
|
public void setupFlows() {
|
||||||
RequiredActionProviderRepresentation rep = adminClient.realm("test").flows().getRequiredAction("terms_and_conditions");
|
RequiredActionProviderRepresentation rep = adminClient.realm("test").flows().getRequiredAction("terms_and_conditions");
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.client;
|
package org.keycloak.testsuite.client;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.client.registration.Auth;
|
import org.keycloak.client.registration.Auth;
|
||||||
import org.keycloak.client.registration.ClientRegistration;
|
import org.keycloak.client.registration.ClientRegistration;
|
||||||
|
@ -28,7 +26,6 @@ import org.keycloak.models.Constants;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.representations.idm.ProtocolMapperRepresentation;
|
import org.keycloak.representations.idm.ProtocolMapperRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import javax.ws.rs.NotFoundException;
|
import javax.ws.rs.NotFoundException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -36,18 +33,17 @@ import java.util.Collections;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
import static org.hamcrest.core.Is.is;
|
import static org.hamcrest.core.Is.is;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||||
*/
|
*/
|
||||||
public class ClientRegistrationTest extends AbstractClientRegistrationTest {
|
public class ClientRegistrationTest extends AbstractClientRegistrationTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ClientRegistrationTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String CLIENT_ID = "test-client";
|
private static final String CLIENT_ID = "test-client";
|
||||||
private static final String CLIENT_SECRET = "test-client-secret";
|
private static final String CLIENT_SECRET = "test-client-secret";
|
||||||
|
|
||||||
|
|
|
@ -17,17 +17,9 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.cluster;
|
package org.keycloak.testsuite.cluster;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.UriBuilder;
|
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.infinispan.Cache;
|
import org.infinispan.Cache;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -38,13 +30,14 @@ import org.keycloak.models.sessions.infinispan.util.InfinispanUtil;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.services.resources.RealmsResource;
|
import org.keycloak.services.resources.RealmsResource;
|
||||||
import org.keycloak.sessions.StickySessionEncoderProvider;
|
import org.keycloak.sessions.StickySessionEncoderProvider;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||||
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
import javax.ws.rs.core.UriBuilder;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
|
|
||||||
|
@ -53,18 +46,6 @@ import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
*/
|
*/
|
||||||
public class AuthenticationSessionClusterTest extends AbstractClusterTest {
|
public class AuthenticationSessionClusterTest extends AbstractClusterTest {
|
||||||
|
|
||||||
@Deployment(name = "node0")
|
|
||||||
@TargetsContainer(QUALIFIER_AUTH_SERVER_NODE_1)
|
|
||||||
public static WebArchive deployDC0() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
AuthenticationSessionClusterTest.class,
|
|
||||||
AbstractClusterTest.class,
|
|
||||||
AbstractTestRealmKeycloakTest.class,
|
|
||||||
KeycloakTestingClient.class
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Page
|
@Page
|
||||||
protected LoginPage loginPage;
|
protected LoginPage loginPage;
|
||||||
|
|
||||||
|
|
|
@ -17,20 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.crossdc;
|
package org.keycloak.testsuite.crossdc;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
|
|
||||||
import javax.ws.rs.NotFoundException;
|
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.Keycloak;
|
import org.keycloak.admin.client.Keycloak;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
|
import org.keycloak.common.util.Retry;
|
||||||
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
|
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
|
||||||
import org.keycloak.models.Constants;
|
import org.keycloak.models.Constants;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
|
@ -38,52 +30,25 @@ import org.keycloak.models.UserLoginFailureModel;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.common.util.Retry;
|
|
||||||
import org.keycloak.testsuite.admin.concurrency.AbstractConcurrencyTest;
|
import org.keycloak.testsuite.admin.concurrency.AbstractConcurrencyTest;
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientBuilder;
|
import org.keycloak.testsuite.util.ClientBuilder;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
|
import javax.ws.rs.NotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class BruteForceCrossDCTest extends AbstractAdminCrossDCTest {
|
public class BruteForceCrossDCTest extends AbstractAdminCrossDCTest {
|
||||||
|
|
||||||
private static final String REALM_NAME = "brute-force-test";
|
private static final String REALM_NAME = "brute-force-test";
|
||||||
|
|
||||||
@Deployment(name = "dc0")
|
|
||||||
@TargetsContainer(QUALIFIER_AUTH_SERVER_DC_0_NODE_1)
|
|
||||||
public static WebArchive deployDC0() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
BruteForceCrossDCTest.class,
|
|
||||||
AbstractAdminCrossDCTest.class,
|
|
||||||
AbstractCrossDCTest.class,
|
|
||||||
AbstractTestRealmKeycloakTest.class,
|
|
||||||
KeycloakTestingClient.class,
|
|
||||||
Keycloak.class,
|
|
||||||
RealmResource.class
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deployment(name = "dc1")
|
|
||||||
@TargetsContainer(QUALIFIER_AUTH_SERVER_DC_1_NODE_1)
|
|
||||||
public static WebArchive deployDC1() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
BruteForceCrossDCTest.class,
|
|
||||||
AbstractAdminCrossDCTest.class,
|
|
||||||
AbstractCrossDCTest.class,
|
|
||||||
AbstractTestRealmKeycloakTest.class,
|
|
||||||
KeycloakTestingClient.class,
|
|
||||||
Keycloak.class,
|
|
||||||
RealmResource.class
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void beforeTest() {
|
public void beforeTest() {
|
||||||
log.debug("--DC: creating test realm");
|
log.debug("--DC: creating test realm");
|
||||||
|
|
|
@ -18,64 +18,30 @@
|
||||||
package org.keycloak.testsuite.crossdc;
|
package org.keycloak.testsuite.crossdc;
|
||||||
|
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
|
|
||||||
import javax.ws.rs.NotFoundException;
|
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
|
import org.keycloak.common.util.Retry;
|
||||||
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
|
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.UserSessionModel;
|
import org.keycloak.models.UserSessionModel;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.services.managers.AuthenticationManager;
|
import org.keycloak.services.managers.AuthenticationManager;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.common.util.Retry;
|
|
||||||
import org.keycloak.testsuite.arquillian.InfinispanStatistics;
|
import org.keycloak.testsuite.arquillian.InfinispanStatistics;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.JmxInfinispanCacheStatistics;
|
import org.keycloak.testsuite.arquillian.annotation.JmxInfinispanCacheStatistics;
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
|
|
||||||
|
import javax.ws.rs.NotFoundException;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class LastSessionRefreshCrossDCTest extends AbstractAdminCrossDCTest {
|
public class LastSessionRefreshCrossDCTest extends AbstractAdminCrossDCTest {
|
||||||
|
|
||||||
@Deployment(name = "dc0")
|
|
||||||
@TargetsContainer(QUALIFIER_AUTH_SERVER_DC_0_NODE_1)
|
|
||||||
public static WebArchive deployDC0() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
LastSessionRefreshCrossDCTest.class,
|
|
||||||
AbstractAdminCrossDCTest.class,
|
|
||||||
AbstractCrossDCTest.class,
|
|
||||||
AbstractTestRealmKeycloakTest.class,
|
|
||||||
KeycloakTestingClient.class,
|
|
||||||
InfinispanStatistics.class
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deployment(name = "dc1")
|
|
||||||
@TargetsContainer(QUALIFIER_AUTH_SERVER_DC_1_NODE_1)
|
|
||||||
public static WebArchive deployDC1() {
|
|
||||||
return RunOnServerDeployment.create(
|
|
||||||
LastSessionRefreshCrossDCTest.class,
|
|
||||||
AbstractAdminCrossDCTest.class,
|
|
||||||
AbstractCrossDCTest.class,
|
|
||||||
AbstractTestRealmKeycloakTest.class,
|
|
||||||
KeycloakTestingClient.class,
|
|
||||||
InfinispanStatistics.class
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRevokeRefreshToken(@JmxInfinispanCacheStatistics(dc=DC.FIRST, managementPortProperty = "cache.server.management.port", cacheName=InfinispanConnectionProvider.USER_SESSION_CACHE_NAME) InfinispanStatistics sessionCacheDc1Stats,
|
public void testRevokeRefreshToken(@JmxInfinispanCacheStatistics(dc=DC.FIRST, managementPortProperty = "cache.server.management.port", cacheName=InfinispanConnectionProvider.USER_SESSION_CACHE_NAME) InfinispanStatistics sessionCacheDc1Stats,
|
||||||
@JmxInfinispanCacheStatistics(dc=DC.SECOND, managementPortProperty = "cache.server.2.management.port", cacheName=InfinispanConnectionProvider.USER_SESSION_CACHE_NAME) InfinispanStatistics sessionCacheDc2Stats,
|
@JmxInfinispanCacheStatistics(dc=DC.SECOND, managementPortProperty = "cache.server.2.management.port", cacheName=InfinispanConnectionProvider.USER_SESSION_CACHE_NAME) InfinispanStatistics sessionCacheDc2Stats,
|
||||||
|
|
|
@ -18,28 +18,35 @@
|
||||||
package org.keycloak.testsuite.exportimport;
|
package org.keycloak.testsuite.exportimport;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.spi.client.container.LifecycleException;
|
import org.jboss.arquillian.container.spi.client.container.LifecycleException;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.authentication.requiredactions.WebAuthnRegister;
|
|
||||||
import org.keycloak.authentication.requiredactions.WebAuthnRegisterFactory;
|
import org.keycloak.authentication.requiredactions.WebAuthnRegisterFactory;
|
||||||
import org.keycloak.exportimport.ExportImportConfig;
|
import org.keycloak.exportimport.ExportImportConfig;
|
||||||
import org.keycloak.exportimport.dir.DirExportProvider;
|
import org.keycloak.exportimport.dir.DirExportProvider;
|
||||||
import org.keycloak.exportimport.dir.DirExportProviderFactory;
|
import org.keycloak.exportimport.dir.DirExportProviderFactory;
|
||||||
import org.keycloak.exportimport.singlefile.SingleFileExportProviderFactory;
|
import org.keycloak.exportimport.singlefile.SingleFileExportProviderFactory;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.representations.idm.*;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
|
import org.keycloak.representations.idm.KeysMetadataRepresentation;
|
||||||
|
import org.keycloak.representations.idm.RealmEventsConfigRepresentation;
|
||||||
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
import org.keycloak.representations.idm.RequiredActionProviderRepresentation;
|
||||||
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.runonserver.RunHelpers;
|
import org.keycloak.testsuite.runonserver.RunHelpers;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -56,11 +63,6 @@ import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
*/
|
*/
|
||||||
public class ExportImportTest extends AbstractKeycloakTest {
|
public class ExportImportTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ExportImportTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
RealmRepresentation testRealm1 = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class);
|
RealmRepresentation testRealm1 = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class);
|
||||||
|
|
|
@ -17,31 +17,20 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.kerberos;
|
package org.keycloak.testsuite.federation.kerberos;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.federation.kerberos.CommonKerberosConfig;
|
import org.keycloak.federation.kerberos.CommonKerberosConfig;
|
||||||
import org.keycloak.models.RealmModel;
|
|
||||||
import org.keycloak.representations.AccessToken;
|
import org.keycloak.representations.AccessToken;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProviderFactory;
|
import org.keycloak.storage.ldap.LDAPStorageProviderFactory;
|
||||||
import org.keycloak.storage.ldap.kerberos.LDAPProviderKerberosConfig;
|
import org.keycloak.storage.ldap.kerberos.LDAPProviderKerberosConfig;
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.federation.ldap.LDAPTestContext;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.KerberosRule;
|
import org.keycloak.testsuite.util.KerberosRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
|
||||||
import org.keycloak.util.ldap.KerberosEmbeddedServer;
|
import org.keycloak.util.ldap.KerberosEmbeddedServer;
|
||||||
import org.keycloak.util.ldap.LDAPEmbeddedServer;
|
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
|
@ -49,17 +38,6 @@ import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SE
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class KerberosLdapCrossRealmTrustTest extends AbstractKerberosTest {
|
public class KerberosLdapCrossRealmTrustTest extends AbstractKerberosTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, LDAPEmbeddedServer.class, KerberosEmbeddedServer.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap",
|
|
||||||
"org.keycloak.testsuite.federation.kerberos");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static final String PROVIDER_CONFIG_LOCATION = "classpath:kerberos/kerberos-ldap-crt-connection.properties";
|
private static final String PROVIDER_CONFIG_LOCATION = "classpath:kerberos/kerberos-ldap-crt-connection.properties";
|
||||||
|
|
||||||
@ClassRule
|
@ClassRule
|
||||||
|
|
|
@ -17,42 +17,23 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.kerberos;
|
package org.keycloak.testsuite.federation.kerberos;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.federation.kerberos.CommonKerberosConfig;
|
import org.keycloak.federation.kerberos.CommonKerberosConfig;
|
||||||
import org.keycloak.federation.kerberos.KerberosConfig;
|
import org.keycloak.federation.kerberos.KerberosConfig;
|
||||||
import org.keycloak.federation.kerberos.KerberosFederationProviderFactory;
|
import org.keycloak.federation.kerberos.KerberosFederationProviderFactory;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.testsuite.federation.ldap.AbstractLDAPTest;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.KerberosRule;
|
import org.keycloak.testsuite.util.KerberosRule;
|
||||||
import org.keycloak.util.ldap.KerberosEmbeddedServer;
|
import org.keycloak.util.ldap.KerberosEmbeddedServer;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class KerberosStandaloneCrossRealmTrustTest extends AbstractKerberosTest {
|
public class KerberosStandaloneCrossRealmTrustTest extends AbstractKerberosTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class, AbstractKerberosTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap",
|
|
||||||
"org.keycloak.testsuite.federation.kerberos");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static final String PROVIDER_CONFIG_LOCATION = "classpath:kerberos/kerberos-standalone-connection.properties";
|
private static final String PROVIDER_CONFIG_LOCATION = "classpath:kerberos/kerberos-standalone-connection.properties";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,23 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ws.rs.ClientErrorException;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.component.ComponentValidationException;
|
import org.keycloak.component.ComponentValidationException;
|
||||||
import org.keycloak.models.LDAPConstants;
|
import org.keycloak.models.LDAPConstants;
|
||||||
|
@ -48,11 +37,14 @@ import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import org.keycloak.storage.ldap.mappers.LDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.LDAPStorageMapper;
|
||||||
import org.keycloak.storage.ldap.mappers.UserAttributeLDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.UserAttributeLDAPStorageMapper;
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import javax.ws.rs.ClientErrorException;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
|
@ -63,16 +55,6 @@ public class LDAPBinaryAttributesTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,33 +17,26 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
|
||||||
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
|
||||||
import org.keycloak.models.GroupModel;
|
import org.keycloak.models.GroupModel;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.LDAPConstants;
|
import org.keycloak.models.LDAPConstants;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
|
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
||||||
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
||||||
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
||||||
import org.keycloak.storage.user.SynchronizationResult;
|
import org.keycloak.storage.user.SynchronizationResult;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -54,16 +47,6 @@ public class LDAPGroupMapper2WaySyncTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,10 +17,7 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
|
@ -28,8 +25,13 @@ import org.junit.FixMethodOrder;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
|
import org.keycloak.models.GroupModel;
|
||||||
|
import org.keycloak.models.LDAPConstants;
|
||||||
|
import org.keycloak.models.ModelException;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.representations.idm.SynchronizationResultRepresentation;
|
import org.keycloak.representations.idm.SynchronizationResultRepresentation;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
|
@ -40,14 +42,7 @@ import org.keycloak.storage.ldap.mappers.membership.MembershipType;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
||||||
import org.keycloak.models.GroupModel;
|
|
||||||
import org.keycloak.models.LDAPConstants;
|
|
||||||
import org.keycloak.models.ModelException;
|
|
||||||
import org.keycloak.models.RealmModel;
|
|
||||||
import org.keycloak.models.UserModel;
|
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
|
||||||
import org.keycloak.storage.user.SynchronizationResult;
|
import org.keycloak.storage.user.SynchronizationResult;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
|
@ -56,7 +51,6 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
import static org.keycloak.testsuite.util.LDAPTestUtils.getGroupDescriptionLDAPAttrName;
|
import static org.keycloak.testsuite.util.LDAPTestUtils.getGroupDescriptionLDAPAttrName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,16 +67,6 @@ public class LDAPGroupMapperSyncTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,43 +17,37 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.naming.directory.SearchControls;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.GroupModel;
|
import org.keycloak.models.GroupModel;
|
||||||
|
import org.keycloak.models.LDAPConstants;
|
||||||
import org.keycloak.models.ModelException;
|
import org.keycloak.models.ModelException;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.storage.ldap.LDAPConfig;
|
import org.keycloak.storage.ldap.LDAPConfig;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
import org.keycloak.storage.ldap.LDAPUtils;
|
import org.keycloak.storage.ldap.LDAPUtils;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPDn;
|
import org.keycloak.storage.ldap.idm.model.LDAPDn;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
|
import org.keycloak.storage.ldap.idm.query.internal.LDAPQuery;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.MembershipType;
|
import org.keycloak.storage.ldap.mappers.membership.MembershipType;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper;
|
||||||
import org.keycloak.models.LDAPConstants;
|
|
||||||
import org.keycloak.models.RealmModel;
|
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
|
||||||
import org.keycloak.storage.ldap.idm.query.internal.LDAPQuery;
|
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import javax.naming.directory.SearchControls;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.util.LDAPTestUtils.getGroupDescriptionLDAPAttrName;
|
import static org.keycloak.testsuite.util.LDAPTestUtils.getGroupDescriptionLDAPAttrName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,16 +59,6 @@ public class LDAPGroupMapperTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,16 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
@ -34,7 +30,6 @@ import org.keycloak.storage.UserStorageProvider;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
@ -42,7 +37,6 @@ import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that legacy UserFederationProvider json export is converted to ComponentModel
|
* Tests that legacy UserFederationProvider json export is converted to ComponentModel
|
||||||
|
@ -60,16 +54,6 @@ public class LDAPLegacyImportTest extends AbstractLDAPTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,15 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.LDAPConstants;
|
import org.keycloak.models.LDAPConstants;
|
||||||
|
@ -38,13 +34,10 @@ import org.keycloak.storage.ldap.mappers.FullNameLDAPStorageMapper;
|
||||||
import org.keycloak.storage.ldap.mappers.FullNameLDAPStorageMapperFactory;
|
import org.keycloak.storage.ldap.mappers.FullNameLDAPStorageMapperFactory;
|
||||||
import org.keycloak.storage.ldap.mappers.LDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.LDAPStorageMapper;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for the MSAD setup with usernameAttribute=sAMAccountName, rdnAttribute=cn and fullNameMapper mapped to cn
|
* Test for the MSAD setup with usernameAttribute=sAMAccountName, rdnAttribute=cn and fullNameMapper mapped to cn
|
||||||
*
|
*
|
||||||
|
@ -68,17 +61,6 @@ public class LDAPMSADFullNameTest extends AbstractLDAPTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,29 +17,22 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -58,17 +51,6 @@ public class LDAPMSADMapperTest extends AbstractLDAPTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,15 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.LDAPConstants;
|
import org.keycloak.models.LDAPConstants;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
|
@ -36,7 +32,6 @@ import org.keycloak.protocol.oidc.mappers.UserAttributeMapper;
|
||||||
import org.keycloak.representations.IDToken;
|
import org.keycloak.representations.IDToken;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
@ -48,8 +43,6 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -67,16 +60,6 @@ public class LDAPMultipleAttributesTest extends AbstractLDAPTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,17 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.LDAPConstants;
|
import org.keycloak.models.LDAPConstants;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
|
@ -36,12 +30,11 @@ import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import org.keycloak.storage.ldap.mappers.LDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.LDAPStorageMapper;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for special scenarios, which don't work on MSAD (eg. renaming user RDN to "sn=john2" )
|
* Test for special scenarios, which don't work on MSAD (eg. renaming user RDN to "sn=john2" )
|
||||||
|
@ -61,16 +54,6 @@ public class LDAPNoMSADTest extends AbstractLDAPTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,26 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.naming.AuthenticationException;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.credential.CredentialModel;
|
import org.keycloak.credential.CredentialModel;
|
||||||
import org.keycloak.models.GroupModel;
|
import org.keycloak.models.GroupModel;
|
||||||
|
@ -74,11 +60,18 @@ import org.keycloak.storage.ldap.mappers.UserAttributeLDAPStorageMapper;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
import org.keycloak.testsuite.AbstractAuthTest;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
|
|
||||||
|
import javax.naming.AuthenticationException;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -88,16 +81,6 @@ public class LDAPProvidersIntegrationTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,41 +17,34 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
|
import org.keycloak.models.AccountRoles;
|
||||||
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.Constants;
|
||||||
|
import org.keycloak.models.LDAPConstants;
|
||||||
import org.keycloak.models.ModelException;
|
import org.keycloak.models.ModelException;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RoleModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.services.managers.UserStorageSyncManager;
|
import org.keycloak.services.managers.UserStorageSyncManager;
|
||||||
import org.keycloak.storage.UserStorageProviderModel;
|
import org.keycloak.storage.UserStorageProviderModel;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
||||||
import org.keycloak.models.AccountRoles;
|
|
||||||
import org.keycloak.models.ClientModel;
|
|
||||||
import org.keycloak.models.Constants;
|
|
||||||
import org.keycloak.models.LDAPConstants;
|
|
||||||
import org.keycloak.models.RealmModel;
|
|
||||||
import org.keycloak.models.RoleModel;
|
|
||||||
import org.keycloak.models.UserModel;
|
|
||||||
import org.keycloak.storage.ldap.mappers.membership.role.RoleLDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.membership.role.RoleLDAPStorageMapper;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.role.RoleMapperConfig;
|
import org.keycloak.storage.ldap.mappers.membership.role.RoleMapperConfig;
|
||||||
import org.keycloak.storage.user.SynchronizationResult;
|
import org.keycloak.storage.user.SynchronizationResult;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -62,17 +55,6 @@ public class LDAPRoleMappingsTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,19 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.GroupModel;
|
import org.keycloak.models.GroupModel;
|
||||||
import org.keycloak.models.LDAPConstants;
|
import org.keycloak.models.LDAPConstants;
|
||||||
|
@ -42,12 +35,13 @@ import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
import org.keycloak.testsuite.util.LDAPTestConfiguration;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.util.LDAPTestUtils.getGroupDescriptionLDAPAttrName;
|
import static org.keycloak.testsuite.util.LDAPTestUtils.getGroupDescriptionLDAPAttrName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,16 +64,6 @@ public class LDAPSpecialCharsTest extends AbstractLDAPTest {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -18,45 +18,38 @@
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.GroupModel;
|
import org.keycloak.models.GroupModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
|
||||||
import org.keycloak.representations.idm.SynchronizationResultRepresentation;
|
|
||||||
import org.keycloak.services.managers.UserStorageSyncManager;
|
|
||||||
import org.keycloak.storage.ldap.LDAPUtils;
|
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
|
||||||
import org.keycloak.models.KeycloakSessionFactory;
|
import org.keycloak.models.KeycloakSessionFactory;
|
||||||
import org.keycloak.models.LDAPConstants;
|
import org.keycloak.models.LDAPConstants;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.UserProvider;
|
import org.keycloak.models.UserProvider;
|
||||||
import org.keycloak.models.cache.UserCache;
|
import org.keycloak.models.cache.UserCache;
|
||||||
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
|
import org.keycloak.representations.idm.SynchronizationResultRepresentation;
|
||||||
|
import org.keycloak.services.managers.UserStorageSyncManager;
|
||||||
import org.keycloak.storage.UserStorageProviderModel;
|
import org.keycloak.storage.UserStorageProviderModel;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
import org.keycloak.storage.ldap.LDAPStorageProvider;
|
||||||
import org.keycloak.storage.ldap.LDAPStorageProviderFactory;
|
import org.keycloak.storage.ldap.LDAPStorageProviderFactory;
|
||||||
|
import org.keycloak.storage.ldap.LDAPUtils;
|
||||||
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.MembershipType;
|
import org.keycloak.storage.ldap.mappers.membership.MembershipType;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapperFactory;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
import org.keycloak.storage.ldap.mappers.membership.group.GroupMapperConfig;
|
||||||
import org.keycloak.storage.user.SynchronizationResult;
|
import org.keycloak.storage.user.SynchronizationResult;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
import org.keycloak.testsuite.util.WaitUtils;
|
import org.keycloak.testsuite.util.WaitUtils;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
import javax.ws.rs.BadRequestException;
|
import javax.ws.rs.BadRequestException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,16 +61,6 @@ public class LDAPSyncTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,21 +17,15 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap;
|
package org.keycloak.testsuite.federation.ldap;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.ModelDuplicateException;
|
import org.keycloak.models.ModelDuplicateException;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
import org.keycloak.storage.ldap.idm.model.LDAPObject;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerException;
|
import org.keycloak.testsuite.runonserver.RunOnServerException;
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
|
|
||||||
|
@ -45,15 +39,6 @@ public class LdapUsernameAttributeTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -17,15 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.ldap.noimport;
|
package org.keycloak.testsuite.federation.ldap.noimport;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
import org.junit.ClassRule;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.AccountRoles;
|
import org.keycloak.models.AccountRoles;
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
|
@ -41,14 +37,11 @@ import org.keycloak.storage.ldap.mappers.membership.LDAPGroupMapperMode;
|
||||||
import org.keycloak.storage.ldap.mappers.membership.role.RoleLDAPStorageMapper;
|
import org.keycloak.storage.ldap.mappers.membership.role.RoleLDAPStorageMapper;
|
||||||
import org.keycloak.testsuite.federation.ldap.AbstractLDAPTest;
|
import org.keycloak.testsuite.federation.ldap.AbstractLDAPTest;
|
||||||
import org.keycloak.testsuite.federation.ldap.LDAPTestContext;
|
import org.keycloak.testsuite.federation.ldap.LDAPTestContext;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
import org.keycloak.testsuite.util.LDAPRule;
|
||||||
import org.keycloak.testsuite.util.LDAPTestUtils;
|
import org.keycloak.testsuite.util.LDAPTestUtils;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -59,18 +52,6 @@ public class LDAPRoleMappingsNoImportTest extends AbstractLDAPTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static LDAPRule ldapRule = new LDAPRule();
|
public static LDAPRule ldapRule = new LDAPRule();
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AbstractLDAPTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.federation.ldap",
|
|
||||||
"org.keycloak.testsuite.federation.ldap.noimport");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LDAPRule getLDAPRule() {
|
protected LDAPRule getLDAPRule() {
|
||||||
return ldapRule;
|
return ldapRule;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.keycloak.testsuite.federation.storage;
|
package org.keycloak.testsuite.federation.storage;
|
||||||
|
|
||||||
|
import org.hamcrest.Matchers;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.GroupResource;
|
import org.keycloak.admin.client.resource.GroupResource;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.admin.client.resource.UserResource;
|
||||||
import org.keycloak.common.util.MultivaluedHashMap;
|
import org.keycloak.common.util.MultivaluedHashMap;
|
||||||
|
@ -12,20 +15,16 @@ import org.keycloak.storage.UserStorageProvider;
|
||||||
import org.keycloak.testsuite.admin.concurrency.AbstractConcurrencyTest;
|
import org.keycloak.testsuite.admin.concurrency.AbstractConcurrencyTest;
|
||||||
import org.keycloak.testsuite.federation.UserMapStorage;
|
import org.keycloak.testsuite.federation.UserMapStorage;
|
||||||
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.updaters.Creator;
|
import org.keycloak.testsuite.updaters.Creator;
|
||||||
import org.keycloak.testsuite.util.GroupBuilder;
|
import org.keycloak.testsuite.util.GroupBuilder;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import org.hamcrest.Matchers;
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
||||||
|
@ -43,13 +42,6 @@ public abstract class AbstractUserStorageDirtyDeletionTest extends AbstractConcu
|
||||||
|
|
||||||
private List<Creator<UserResource>> createdUsers;
|
private List<Creator<UserResource>> createdUsers;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create()
|
|
||||||
.addPackages(true, "org.keycloak.testsuite")
|
|
||||||
.addPackages(true, "org.keycloak.admin.client");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void remove20UsersFromStorageProvider(KeycloakSession session) {
|
public static void remove20UsersFromStorageProvider(KeycloakSession session) {
|
||||||
assertThat(REMOVED_USERS_COUNT, Matchers.lessThan(NUM_USERS));
|
assertThat(REMOVED_USERS_COUNT, Matchers.lessThan(NUM_USERS));
|
||||||
final RealmModel realm = session.realms().getRealm(TEST_REALM_NAME);
|
final RealmModel realm = session.realms().getRealm(TEST_REALM_NAME);
|
||||||
|
|
|
@ -17,10 +17,8 @@
|
||||||
package org.keycloak.testsuite.federation.storage;
|
package org.keycloak.testsuite.federation.storage;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.ContainerController;
|
import org.jboss.arquillian.container.test.api.ContainerController;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -33,11 +31,9 @@ import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.storage.UserStorageProvider;
|
import org.keycloak.storage.UserStorageProvider;
|
||||||
import org.keycloak.storage.UserStorageProviderModel;
|
import org.keycloak.storage.UserStorageProviderModel;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -49,12 +45,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class BrokenUserStorageTest extends AbstractTestRealmKeycloakTest {
|
public class BrokenUserStorageTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ComponentExportImportTest.class, AbstractAuthTest.class, RealmResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ArquillianResource
|
@ArquillianResource
|
||||||
protected ContainerController controller;
|
protected ContainerController controller;
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.storage;
|
package org.keycloak.testsuite.federation.storage;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.util.MultivaluedHashMap;
|
import org.keycloak.common.util.MultivaluedHashMap;
|
||||||
import org.keycloak.events.Details;
|
import org.keycloak.events.Details;
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
|
@ -47,7 +44,6 @@ import org.keycloak.testsuite.federation.HardcodedClientStorageProviderFactory;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.util.BasicAuthHelper;
|
import org.keycloak.util.BasicAuthHelper;
|
||||||
import org.keycloak.util.TokenUtil;
|
import org.keycloak.util.TokenUtil;
|
||||||
|
@ -95,12 +91,6 @@ public class ClientStorageTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
protected String providerId;
|
protected String providerId;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String addComponent(ComponentRepresentation component) {
|
protected String addComponent(ComponentRepresentation component) {
|
||||||
Response resp = adminClient.realm("test").components().add(component);
|
Response resp = adminClient.realm("test").components().add(component);
|
||||||
resp.close();
|
resp.close();
|
||||||
|
|
|
@ -1,17 +1,7 @@
|
||||||
package org.keycloak.testsuite.federation.storage;
|
package org.keycloak.testsuite.federation.storage;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Set;
|
|
||||||
import javax.ws.rs.NotFoundException;
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.common.util.MultivaluedHashMap;
|
import org.keycloak.common.util.MultivaluedHashMap;
|
||||||
|
@ -24,12 +14,17 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.storage.UserStorageProvider;
|
import org.keycloak.storage.UserStorageProvider;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
import org.keycloak.testsuite.AbstractAuthTest;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import static org.keycloak.testsuite.auth.page.AuthRealm.TEST;
|
|
||||||
|
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
||||||
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
|
|
||||||
|
import javax.ws.rs.NotFoundException;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,12 +37,6 @@ public class ComponentExportImportTest extends AbstractAuthTest {
|
||||||
|
|
||||||
private File exportFile;
|
private File exportFile;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ComponentExportImportTest.class, AbstractAuthTest.class, RealmResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setDirs() {
|
public void setDirs() {
|
||||||
exportFile = new File (new File(System.getProperty("auth.server.config.dir", "target")), "singleFile-full.json");
|
exportFile = new File (new File(System.getProperty("auth.server.config.dir", "target")), "singleFile-full.json");
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.federation.storage;
|
package org.keycloak.testsuite.federation.storage;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -38,14 +36,12 @@ import org.keycloak.models.RoleModel;
|
||||||
import org.keycloak.models.credential.PasswordCredentialModel;
|
import org.keycloak.models.credential.PasswordCredentialModel;
|
||||||
import org.keycloak.services.managers.RealmManager;
|
import org.keycloak.services.managers.RealmManager;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
import org.keycloak.testsuite.AbstractAuthTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
|
import javax.ws.rs.NotFoundException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ws.rs.NotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
|
@ -57,13 +53,6 @@ public class FederatedStorageExportImportTest extends AbstractAuthTest {
|
||||||
private String exportFileAbsolutePath;
|
private String exportFileAbsolutePath;
|
||||||
private String exportDirAbsolutePath;
|
private String exportDirAbsolutePath;
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ComponentExportImportTest.class, AbstractAuthTest.class, RealmResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setDirs() {
|
public void setDirs() {
|
||||||
File baseDir = new File(System.getProperty("auth.server.config.dir", "target"));
|
File baseDir = new File(System.getProperty("auth.server.config.dir", "target"));
|
||||||
|
|
|
@ -17,10 +17,8 @@
|
||||||
package org.keycloak.testsuite.federation.storage;
|
package org.keycloak.testsuite.federation.storage;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.ContainerController;
|
import org.jboss.arquillian.container.test.api.ContainerController;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
@ -45,17 +43,14 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.services.managers.RealmManager;
|
import org.keycloak.services.managers.RealmManager;
|
||||||
import org.keycloak.storage.UserStorageProvider;
|
import org.keycloak.storage.UserStorageProvider;
|
||||||
import org.keycloak.storage.UserStorageProviderModel;
|
import org.keycloak.storage.UserStorageProviderModel;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.AssertEvents;
|
import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||||
import org.keycloak.testsuite.federation.FailableHardcodedStorageProvider;
|
import org.keycloak.testsuite.federation.FailableHardcodedStorageProvider;
|
||||||
import org.keycloak.testsuite.federation.FailableHardcodedStorageProviderFactory;
|
import org.keycloak.testsuite.federation.FailableHardcodedStorageProviderFactory;
|
||||||
import org.keycloak.testsuite.pages.AccountApplicationsPage;
|
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
import org.keycloak.testsuite.util.ContainerAssume;
|
||||||
import org.keycloak.testsuite.util.Matchers;
|
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -64,7 +59,6 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.keycloak.testsuite.util.ContainerAssume;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
@ -74,12 +68,6 @@ public class UserStorageFailureTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
private static boolean initialized = false;
|
private static boolean initialized = false;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ComponentExportImportTest.class, AbstractAuthTest.class, RealmResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String LOCAL_USER = "localUser";
|
private static final String LOCAL_USER = "localUser";
|
||||||
|
|
||||||
private String failureProviderId;
|
private String failureProviderId;
|
||||||
|
@ -102,7 +90,7 @@ public class UserStorageFailureTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void addProvidersBeforeTest() throws URISyntaxException, IOException {
|
public void addProvidersBeforeTest() {
|
||||||
ComponentRepresentation memProvider = new ComponentRepresentation();
|
ComponentRepresentation memProvider = new ComponentRepresentation();
|
||||||
memProvider.setName("failure");
|
memProvider.setName("failure");
|
||||||
memProvider.setProviderId(FailableHardcodedStorageProviderFactory.PROVIDER_ID);
|
memProvider.setProviderId(FailableHardcodedStorageProviderFactory.PROVIDER_ID);
|
||||||
|
@ -113,6 +101,8 @@ public class UserStorageFailureTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
if (initialized) return;
|
if (initialized) return;
|
||||||
|
|
||||||
|
final String authServerRoot = OAuthClient.AUTH_SERVER_ROOT;
|
||||||
|
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
RealmManager manager = new RealmManager(session);
|
RealmManager manager = new RealmManager(session);
|
||||||
RealmModel appRealm = manager.getRealmByName(AuthRealm.TEST);
|
RealmModel appRealm = manager.getRealmByName(AuthRealm.TEST);
|
||||||
|
@ -123,7 +113,7 @@ public class UserStorageFailureTest extends AbstractTestRealmKeycloakTest {
|
||||||
offlineClient.setDirectAccessGrantsEnabled(true);
|
offlineClient.setDirectAccessGrantsEnabled(true);
|
||||||
offlineClient.setSecret("secret");
|
offlineClient.setSecret("secret");
|
||||||
HashSet<String> redirects = new HashSet<>();
|
HashSet<String> redirects = new HashSet<>();
|
||||||
redirects.add(OAuthClient.AUTH_SERVER_ROOT + "/offline-client");
|
redirects.add(authServerRoot + "/offline-client");
|
||||||
offlineClient.setRedirectUris(redirects);
|
offlineClient.setRedirectUris(redirects);
|
||||||
offlineClient.setServiceAccountsEnabled(true);
|
offlineClient.setServiceAccountsEnabled(true);
|
||||||
offlineClient.setFullScopeAllowed(true);
|
offlineClient.setFullScopeAllowed(true);
|
||||||
|
|
|
@ -1,32 +1,12 @@
|
||||||
package org.keycloak.testsuite.federation.storage;
|
package org.keycloak.testsuite.federation.storage;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import static java.util.Calendar.DAY_OF_WEEK;
|
|
||||||
import static java.util.Calendar.HOUR_OF_DAY;
|
|
||||||
import static java.util.Calendar.MINUTE;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import javax.ws.rs.NotFoundException;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.admin.client.resource.UserResource;
|
||||||
|
@ -37,7 +17,6 @@ import org.keycloak.credential.UserCredentialStoreManager;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
import static org.keycloak.models.UserModel.RequiredAction.UPDATE_PROFILE;
|
|
||||||
import org.keycloak.models.cache.CachedUserModel;
|
import org.keycloak.models.cache.CachedUserModel;
|
||||||
import org.keycloak.models.credential.OTPCredentialModel;
|
import org.keycloak.models.credential.OTPCredentialModel;
|
||||||
import org.keycloak.models.credential.PasswordCredentialModel;
|
import org.keycloak.models.credential.PasswordCredentialModel;
|
||||||
|
@ -47,14 +26,9 @@ import org.keycloak.representations.idm.GroupRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
|
import org.keycloak.storage.CacheableStorageProviderModel.CachePolicy;
|
||||||
import org.keycloak.storage.StorageId;
|
import org.keycloak.storage.StorageId;
|
||||||
import org.keycloak.storage.UserStorageProvider;
|
import org.keycloak.storage.UserStorageProvider;
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.CACHE_POLICY;
|
|
||||||
import org.keycloak.storage.CacheableStorageProviderModel.CachePolicy;
|
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.EVICTION_DAY;
|
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.EVICTION_HOUR;
|
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.EVICTION_MINUTE;
|
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.MAX_LIFESPAN;
|
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
import org.keycloak.testsuite.AbstractAuthTest;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
|
@ -64,18 +38,40 @@ import org.keycloak.testsuite.federation.UserPropertyFileStorageFactory;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.RegisterPage;
|
import org.keycloak.testsuite.pages.RegisterPage;
|
||||||
import org.keycloak.testsuite.pages.VerifyEmailPage;
|
import org.keycloak.testsuite.pages.VerifyEmailPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.updaters.RealmAttributeUpdater;
|
import org.keycloak.testsuite.updaters.RealmAttributeUpdater;
|
||||||
import org.keycloak.testsuite.util.GreenMailRule;
|
import org.keycloak.testsuite.util.GreenMailRule;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import javax.mail.internet.MimeMessage;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.keycloak.testsuite.util.TestCleanup;
|
import org.keycloak.testsuite.util.TestCleanup;
|
||||||
|
|
||||||
|
import javax.mail.internet.MimeMessage;
|
||||||
|
import javax.ws.rs.NotFoundException;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
import static java.util.Calendar.DAY_OF_WEEK;
|
||||||
|
import static java.util.Calendar.HOUR_OF_DAY;
|
||||||
|
import static java.util.Calendar.MINUTE;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.keycloak.models.UserModel.RequiredAction.UPDATE_PROFILE;
|
||||||
|
import static org.keycloak.storage.UserStorageProviderModel.CACHE_POLICY;
|
||||||
|
import static org.keycloak.storage.UserStorageProviderModel.EVICTION_DAY;
|
||||||
|
import static org.keycloak.storage.UserStorageProviderModel.EVICTION_HOUR;
|
||||||
|
import static org.keycloak.storage.UserStorageProviderModel.EVICTION_MINUTE;
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
||||||
|
import static org.keycloak.storage.UserStorageProviderModel.MAX_LIFESPAN;
|
||||||
import static org.keycloak.testsuite.actions.RequiredActionEmailVerificationTest.getPasswordResetEmailLink;
|
import static org.keycloak.testsuite.actions.RequiredActionEmailVerificationTest.getPasswordResetEmailLink;
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlDoesntStartWith;
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlDoesntStartWith;
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
|
||||||
|
@ -464,13 +460,6 @@ public class UserStorageTest extends AbstractAuthTest {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite")
|
|
||||||
.addPackages(true, "org.keycloak.admin.client.resource");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setDailyEvictionTime(int hour, int minutes) {
|
private void setDailyEvictionTime(int hour, int minutes) {
|
||||||
if (hour < 0 || hour > 23) {
|
if (hour < 0 || hour > 23) {
|
||||||
throw new IllegalArgumentException("hour == " + hour);
|
throw new IllegalArgumentException("hour == " + hour);
|
||||||
|
|
|
@ -17,14 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.federation.sync;
|
package org.keycloak.testsuite.federation.sync;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.KeycloakSessionFactory;
|
import org.keycloak.models.KeycloakSessionFactory;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
|
@ -35,8 +32,6 @@ import org.keycloak.storage.user.SynchronizationResult;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
import org.keycloak.testsuite.AbstractAuthTest;
|
||||||
import org.keycloak.testsuite.auth.page.AuthRealm;
|
import org.keycloak.testsuite.auth.page.AuthRealm;
|
||||||
import org.keycloak.testsuite.federation.DummyUserFederationProviderFactory;
|
import org.keycloak.testsuite.federation.DummyUserFederationProviderFactory;
|
||||||
import org.keycloak.testsuite.federation.storage.ComponentExportImportTest;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.timer.TimerProvider;
|
import org.keycloak.timer.TimerProvider;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -53,13 +48,6 @@ public class SyncFederationTest extends AbstractAuthTest {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(SyncFederationTest.class);
|
private static final Logger log = Logger.getLogger(SyncFederationTest.class);
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ComponentExportImportTest.class, AbstractAuthTest.class, RealmResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that period sync is triggered when creating a synchronized User Storage Provider
|
* Test that period sync is triggered when creating a synchronized User Storage Provider
|
||||||
*
|
*
|
||||||
|
|
|
@ -17,17 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
|
import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
|
||||||
import org.keycloak.events.Details;
|
import org.keycloak.events.Details;
|
||||||
import org.keycloak.models.AuthenticationExecutionModel;
|
import org.keycloak.models.AuthenticationExecutionModel;
|
||||||
|
@ -43,9 +37,11 @@ import org.keycloak.testsuite.authentication.PushButtonAuthenticatorFactory;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -67,13 +63,6 @@ public class AuthenticatorSubflowsTest extends AbstractTestRealmKeycloakTest {
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setupFlows() {
|
public void setupFlows() {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
|
|
|
@ -17,17 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
|
import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
|
||||||
import org.keycloak.events.Details;
|
import org.keycloak.events.Details;
|
||||||
import org.keycloak.models.AuthenticationExecutionModel;
|
import org.keycloak.models.AuthenticationExecutionModel;
|
||||||
|
@ -43,9 +37,11 @@ import org.keycloak.testsuite.authentication.PushButtonAuthenticatorFactory;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:n1330@me.com">Tomohiro Nagai</a>
|
* @author <a href="mailto:n1330@me.com">Tomohiro Nagai</a>
|
||||||
*/
|
*/
|
||||||
|
@ -67,13 +63,6 @@ public class AuthenticatorSubflowsTest2 extends AbstractTestRealmKeycloakTest {
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setupFlows() {
|
public void setupFlows() {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.arquillian.drone.api.annotation.Drone;
|
import org.jboss.arquillian.drone.api.annotation.Drone;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.authentication.AuthenticationFlow;
|
import org.keycloak.authentication.AuthenticationFlow;
|
||||||
import org.keycloak.authentication.authenticators.browser.OTPFormAuthenticatorFactory;
|
import org.keycloak.authentication.authenticators.browser.OTPFormAuthenticatorFactory;
|
||||||
import org.keycloak.authentication.authenticators.browser.PasswordFormFactory;
|
import org.keycloak.authentication.authenticators.browser.PasswordFormFactory;
|
||||||
|
@ -38,13 +34,11 @@ import org.keycloak.testsuite.admin.authentication.AbstractAuthenticationTest;
|
||||||
import org.keycloak.testsuite.auth.page.login.OneTimeCode;
|
import org.keycloak.testsuite.auth.page.login.OneTimeCode;
|
||||||
import org.keycloak.testsuite.broker.SocialLoginTest;
|
import org.keycloak.testsuite.broker.SocialLoginTest;
|
||||||
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
import org.keycloak.testsuite.client.KeycloakTestingClient;
|
||||||
import org.keycloak.testsuite.model.ClientModelTest;
|
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.LoginTotpPage;
|
import org.keycloak.testsuite.pages.LoginTotpPage;
|
||||||
import org.keycloak.testsuite.pages.LoginUsernameOnlyPage;
|
import org.keycloak.testsuite.pages.LoginUsernameOnlyPage;
|
||||||
import org.keycloak.testsuite.pages.PasswordPage;
|
import org.keycloak.testsuite.pages.PasswordPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.FlowUtil;
|
import org.keycloak.testsuite.util.FlowUtil;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.testsuite.util.URLUtils;
|
import org.keycloak.testsuite.util.URLUtils;
|
||||||
|
@ -58,7 +52,6 @@ import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITHUB;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITHUB;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITLAB;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GITLAB;
|
||||||
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE;
|
import static org.keycloak.testsuite.broker.SocialLoginTest.Provider.GOOGLE;
|
||||||
|
@ -97,15 +90,6 @@ public class BrowserFlowTest extends AbstractTestRealmKeycloakTest {
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, ClientModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
private RealmRepresentation loadTestRealm() {
|
private RealmRepresentation loadTestRealm() {
|
||||||
RealmRepresentation res = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class);
|
RealmRepresentation res = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class);
|
||||||
res.setBrowserFlow("browser");
|
res.setBrowserFlow("browser");
|
||||||
|
|
|
@ -17,14 +17,11 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.authentication.authenticators.console.ConsoleUsernamePasswordAuthenticatorFactory;
|
import org.keycloak.authentication.authenticators.console.ConsoleUsernamePasswordAuthenticatorFactory;
|
||||||
import org.keycloak.models.AuthenticationExecutionModel;
|
import org.keycloak.models.AuthenticationExecutionModel;
|
||||||
import org.keycloak.models.AuthenticationFlowBindings;
|
import org.keycloak.models.AuthenticationFlowBindings;
|
||||||
|
@ -37,7 +34,6 @@ import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
|
@ -52,8 +48,6 @@ import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that clients can override auth flows
|
* Test that clients can override auth flows
|
||||||
*
|
*
|
||||||
|
@ -79,13 +73,6 @@ public class ChallengeFlowTest extends AbstractTestRealmKeycloakTest {
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setupFlows() {
|
public void setupFlows() {
|
||||||
SerializableApplicationData serializedApplicationData = new SerializableApplicationData(oauth.APP_AUTH_ROOT, oauth.APP_ROOT + "/admin", oauth.APP_AUTH_ROOT + "/*");
|
SerializableApplicationData serializedApplicationData = new SerializableApplicationData(oauth.APP_AUTH_ROOT, oauth.APP_ROOT + "/admin", oauth.APP_AUTH_ROOT + "/*");
|
||||||
|
|
|
@ -17,16 +17,13 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.ClientsResource;
|
import org.keycloak.admin.client.resource.ClientsResource;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
|
import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
|
||||||
import org.keycloak.authentication.authenticators.challenge.BasicAuthOTPAuthenticatorFactory;
|
import org.keycloak.authentication.authenticators.challenge.BasicAuthOTPAuthenticatorFactory;
|
||||||
import org.keycloak.events.Details;
|
import org.keycloak.events.Details;
|
||||||
|
@ -48,7 +45,6 @@ import org.keycloak.testsuite.authentication.PushButtonAuthenticatorFactory;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
import org.keycloak.util.BasicAuthHelper;
|
import org.keycloak.util.BasicAuthHelper;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
@ -59,7 +55,6 @@ import javax.ws.rs.client.WebTarget;
|
||||||
import javax.ws.rs.core.Form;
|
import javax.ws.rs.core.Form;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -94,12 +89,6 @@ public class FlowOverrideTest extends AbstractTestRealmKeycloakTest {
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setupFlows() {
|
public void setupFlows() {
|
||||||
SerializableApplicationData serializedApplicationData = new SerializableApplicationData(oauth.APP_AUTH_ROOT, oauth.APP_ROOT + "/admin", oauth.APP_AUTH_ROOT + "/*");
|
SerializableApplicationData serializedApplicationData = new SerializableApplicationData(oauth.APP_AUTH_ROOT, oauth.APP_ROOT + "/admin", oauth.APP_AUTH_ROOT + "/*");
|
||||||
|
|
|
@ -16,9 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.common.util.Base64;
|
import org.keycloak.common.util.Base64;
|
||||||
import org.keycloak.credential.CredentialModel;
|
import org.keycloak.credential.CredentialModel;
|
||||||
|
@ -37,7 +35,6 @@ import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
import javax.crypto.SecretKeyFactory;
|
import javax.crypto.SecretKeyFactory;
|
||||||
|
@ -57,11 +54,6 @@ public class PasswordHashingTest extends AbstractTestRealmKeycloakTest {
|
||||||
@Page
|
@Page
|
||||||
private AccountUpdateProfilePage updateProfilePage;
|
private AccountUpdateProfilePage updateProfilePage;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(PasswordHashingTest.class, AbstractTestRealmKeycloakTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,23 +18,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.mail.internet.MimeMessage;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.AuthenticationFlowModel;
|
|
||||||
import org.keycloak.models.RealmModel;
|
|
||||||
import org.keycloak.models.utils.DefaultAuthenticationFlows;
|
import org.keycloak.models.utils.DefaultAuthenticationFlows;
|
||||||
import org.keycloak.models.utils.TimeBasedOTP;
|
import org.keycloak.models.utils.TimeBasedOTP;
|
||||||
import org.keycloak.representations.idm.AuthenticationFlowRepresentation;
|
import org.keycloak.representations.idm.AuthenticationFlowRepresentation;
|
||||||
|
@ -43,7 +32,6 @@ import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.admin.authentication.AbstractAuthenticationTest;
|
import org.keycloak.testsuite.admin.authentication.AbstractAuthenticationTest;
|
||||||
import org.keycloak.testsuite.model.ClientModelTest;
|
|
||||||
import org.keycloak.testsuite.pages.AccountTotpPage;
|
import org.keycloak.testsuite.pages.AccountTotpPage;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
|
@ -54,16 +42,17 @@ import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||||
import org.keycloak.testsuite.pages.LoginTotpPage;
|
import org.keycloak.testsuite.pages.LoginTotpPage;
|
||||||
import org.keycloak.testsuite.pages.LoginUsernameOnlyPage;
|
import org.keycloak.testsuite.pages.LoginUsernameOnlyPage;
|
||||||
import org.keycloak.testsuite.pages.PasswordPage;
|
import org.keycloak.testsuite.pages.PasswordPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServer;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.FlowUtil;
|
import org.keycloak.testsuite.util.FlowUtil;
|
||||||
import org.keycloak.testsuite.util.GreenMailRule;
|
import org.keycloak.testsuite.util.GreenMailRule;
|
||||||
import org.keycloak.testsuite.util.MailUtils;
|
import org.keycloak.testsuite.util.MailUtils;
|
||||||
import org.keycloak.testsuite.util.URLUtils;
|
import org.keycloak.testsuite.util.URLUtils;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
|
import javax.mail.internet.MimeMessage;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for the various alternatives of reset-credentials flow or browser flow (non-default setup of the flows)
|
* Test for the various alternatives of reset-credentials flow or browser flow (non-default setup of the flows)
|
||||||
|
@ -73,16 +62,6 @@ import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SE
|
||||||
*/
|
*/
|
||||||
public class ResetCredentialsAlternativeFlowsTest extends AbstractTestRealmKeycloakTest {
|
public class ResetCredentialsAlternativeFlowsTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, ClientModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
|
|
@ -17,16 +17,9 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.forms;
|
package org.keycloak.testsuite.forms;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.events.Details;
|
import org.keycloak.events.Details;
|
||||||
import org.keycloak.events.Errors;
|
import org.keycloak.events.Errors;
|
||||||
import org.keycloak.jose.jws.JWSBuilder;
|
import org.keycloak.jose.jws.JWSBuilder;
|
||||||
|
@ -39,9 +32,10 @@ import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.AssertEvents;
|
import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.openqa.selenium.Cookie;
|
import org.openqa.selenium.Cookie;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -55,14 +49,6 @@ public class RestartCookieTest extends AbstractTestRealmKeycloakTest {
|
||||||
@Rule
|
@Rule
|
||||||
public AssertEvents events = new AssertEvents(this);
|
public AssertEvents events = new AssertEvents(this);
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// KC_RESTART cookie from Keycloak 3.1.0
|
// KC_RESTART cookie from Keycloak 3.1.0
|
||||||
private static final String OLD_RESTART_COOKIE_JSON = "{\n" +
|
private static final String OLD_RESTART_COOKIE_JSON = "{\n" +
|
||||||
" \"cs\": \"874a1ea8-5579-4f21-add0-903dd8e3ec1b\",\n" +
|
" \"cs\": \"874a1ea8-5579-4f21-add0-903dd8e3ec1b\",\n" +
|
||||||
|
@ -90,7 +76,7 @@ public class RestartCookieTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
// KEYCLOAK-5440 -- migration from Keycloak 3.1.0
|
// KEYCLOAK-5440 -- migration from Keycloak 3.1.0
|
||||||
@Test
|
@Test
|
||||||
public void testRestartCookieBackwardsCompatible_Keycloak25() throws IOException, MessagingException {
|
public void testRestartCookieBackwardsCompatible_Keycloak25() throws IOException {
|
||||||
String oldRestartCookie = testingClient.server().fetchString((KeycloakSession session) -> {
|
String oldRestartCookie = testingClient.server().fetchString((KeycloakSession session) -> {
|
||||||
try {
|
try {
|
||||||
String cookieVal = OLD_RESTART_COOKIE_JSON.replace("\n", "").replace(" ", "");
|
String cookieVal = OLD_RESTART_COOKIE_JSON.replace("\n", "").replace(" ", "");
|
||||||
|
@ -129,7 +115,7 @@ public class RestartCookieTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
// KEYCLOAK-7158 -- migration from Keycloak 1.9.8
|
// KEYCLOAK-7158 -- migration from Keycloak 1.9.8
|
||||||
@Test
|
@Test
|
||||||
public void testRestartCookieBackwardsCompatible_Keycloak19() throws IOException, MessagingException {
|
public void testRestartCookieBackwardsCompatible_Keycloak19() throws IOException {
|
||||||
String oldRestartCookie = testingClient.server().fetchString((KeycloakSession session) -> {
|
String oldRestartCookie = testingClient.server().fetchString((KeycloakSession session) -> {
|
||||||
try {
|
try {
|
||||||
String cookieVal = OLD_RESTART_COOKIE_JSON.replace("\n", "").replace(" ", "");
|
String cookieVal = OLD_RESTART_COOKIE_JSON.replace("\n", "").replace(" ", "");
|
||||||
|
|
|
@ -17,9 +17,7 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.keys;
|
package org.keycloak.testsuite.keys;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.common.util.Base64Url;
|
import org.keycloak.common.util.Base64Url;
|
||||||
|
@ -38,12 +36,12 @@ import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunHelpers;
|
import org.keycloak.testsuite.runonserver.RunHelpers;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,11 +49,6 @@ import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
*/
|
*/
|
||||||
public class GeneratedHmacKeyProviderTest extends AbstractKeycloakTest {
|
public class GeneratedHmacKeyProviderTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public AssertEvents events = new AssertEvents(this);
|
public AssertEvents events = new AssertEvents(this);
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,10 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.login;
|
package org.keycloak.testsuite.login;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
|
@ -33,29 +28,13 @@ import org.keycloak.models.UserManager;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.UserSessionModel;
|
import org.keycloak.models.UserSessionModel;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.services.managers.AuthenticationManager;
|
|
||||||
import org.keycloak.services.managers.ClientSessionCode;
|
import org.keycloak.services.managers.ClientSessionCode;
|
||||||
import org.keycloak.sessions.CommonClientSessionModel;
|
|
||||||
import org.keycloak.sessions.AuthenticationSessionModel;
|
import org.keycloak.sessions.AuthenticationSessionModel;
|
||||||
|
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
public class LoginTimeoutValidationTest extends AbstractTestRealmKeycloakTest {
|
public class LoginTimeoutValidationTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, LoginTimeoutValidationTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.migration;
|
package org.keycloak.testsuite.migration;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.exportimport.util.ImportUtils;
|
import org.keycloak.exportimport.util.ImportUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.arquillian.DeploymentTargetModifier;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.utils.io.IOUtil;
|
import org.keycloak.testsuite.utils.io.IOUtil;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
|
@ -39,12 +34,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class JsonFileImport198MigrationTest extends AbstractJsonFileImportMigrationTest {
|
public class JsonFileImport198MigrationTest extends AbstractJsonFileImportMigrationTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(DeploymentTargetModifier.AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
Map<String, RealmRepresentation> reps = null;
|
Map<String, RealmRepresentation> reps = null;
|
||||||
|
|
|
@ -16,14 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.migration;
|
package org.keycloak.testsuite.migration;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.exportimport.util.ImportUtils;
|
import org.keycloak.exportimport.util.ImportUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.arquillian.DeploymentTargetModifier;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.utils.io.IOUtil;
|
import org.keycloak.testsuite.utils.io.IOUtil;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
|
@ -39,12 +34,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class JsonFileImport255MigrationTest extends AbstractJsonFileImportMigrationTest {
|
public class JsonFileImport255MigrationTest extends AbstractJsonFileImportMigrationTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(DeploymentTargetModifier.AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
Map<String, RealmRepresentation> reps = null;
|
Map<String, RealmRepresentation> reps = null;
|
||||||
|
|
|
@ -16,14 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.migration;
|
package org.keycloak.testsuite.migration;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.exportimport.util.ImportUtils;
|
import org.keycloak.exportimport.util.ImportUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.arquillian.DeploymentTargetModifier;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.utils.io.IOUtil;
|
import org.keycloak.testsuite.utils.io.IOUtil;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
|
@ -39,12 +34,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class JsonFileImport343MigrationTest extends AbstractJsonFileImportMigrationTest {
|
public class JsonFileImport343MigrationTest extends AbstractJsonFileImportMigrationTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(DeploymentTargetModifier.AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
Map<String, RealmRepresentation> reps = null;
|
Map<String, RealmRepresentation> reps = null;
|
||||||
|
|
|
@ -16,14 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.migration;
|
package org.keycloak.testsuite.migration;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.exportimport.util.ImportUtils;
|
import org.keycloak.exportimport.util.ImportUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.arquillian.DeploymentTargetModifier;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.utils.io.IOUtil;
|
import org.keycloak.testsuite.utils.io.IOUtil;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
|
@ -36,12 +31,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class JsonFileImport483MigrationTest extends AbstractJsonFileImportMigrationTest {
|
public class JsonFileImport483MigrationTest extends AbstractJsonFileImportMigrationTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(DeploymentTargetModifier.AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
Map<String, RealmRepresentation> reps = null;
|
Map<String, RealmRepresentation> reps = null;
|
||||||
|
|
|
@ -16,16 +16,11 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.migration;
|
package org.keycloak.testsuite.migration;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.arquillian.DeploymentTargetModifier;
|
|
||||||
import org.keycloak.testsuite.arquillian.migration.Migration;
|
import org.keycloak.testsuite.arquillian.migration.Migration;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import javax.ws.rs.NotFoundException;
|
import javax.ws.rs.NotFoundException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -37,12 +32,6 @@ import static org.keycloak.testsuite.auth.page.AuthRealm.MASTER;
|
||||||
*/
|
*/
|
||||||
public class MigrationTest extends AbstractMigrationTest {
|
public class MigrationTest extends AbstractMigrationTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(DeploymentTargetModifier.AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
log.info("Adding no test realms for migration test. Test realm should be migrated from previous vesrion.");
|
log.info("Adding no test realms for migration test. Test realm should be migrated from previous vesrion.");
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.models.utils.ResetTimeOffsetEvent;
|
import org.keycloak.models.utils.ResetTimeOffsetEvent;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
@ -36,7 +36,6 @@ import org.keycloak.sessions.CommonClientSessionModel;
|
||||||
import org.keycloak.sessions.RootAuthenticationSessionModel;
|
import org.keycloak.sessions.RootAuthenticationSessionModel;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
@ -44,22 +43,12 @@ import static org.hamcrest.core.Is.is;
|
||||||
import static org.hamcrest.core.IsNull.notNullValue;
|
import static org.hamcrest.core.IsNull.notNullValue;
|
||||||
import static org.hamcrest.core.IsNull.nullValue;
|
import static org.hamcrest.core.IsNull.nullValue;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class AuthenticationSessionProviderTest extends AbstractTestRealmKeycloakTest {
|
public class AuthenticationSessionProviderTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, AuthenticationSessionProviderTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
|
|
|
@ -18,11 +18,7 @@
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.ClientModel;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.RoleModel;
|
import org.keycloak.models.RoleModel;
|
||||||
|
@ -30,19 +26,15 @@ import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.UserSessionModel;
|
import org.keycloak.models.UserSessionModel;
|
||||||
import org.keycloak.models.cache.infinispan.ClientAdapter;
|
import org.keycloak.models.cache.infinispan.ClientAdapter;
|
||||||
import org.keycloak.models.cache.infinispan.RealmAdapter;
|
import org.keycloak.models.cache.infinispan.RealmAdapter;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
|
import org.keycloak.testsuite.Assert;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
|
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.Assert;
|
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
@ -51,16 +43,6 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
|
||||||
public class CacheTest extends AbstractTestRealmKeycloakTest {
|
public class CacheTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, CacheTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ClientModel testApp = null;
|
private ClientModel testApp = null;
|
||||||
private int grantedRolesCount=0;
|
private int grantedRolesCount=0;
|
||||||
private RealmModel realm = null;
|
private RealmModel realm = null;
|
||||||
|
|
|
@ -17,13 +17,14 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.ClientScopeModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.ModelException;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RoleModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.models.utils.ModelToRepresentation;
|
import org.keycloak.models.utils.ModelToRepresentation;
|
||||||
import org.keycloak.models.utils.RepresentationToModel;
|
import org.keycloak.models.utils.RepresentationToModel;
|
||||||
|
@ -34,7 +35,6 @@ import org.keycloak.representations.idm.ProtocolMapperRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -45,7 +45,6 @@ import static org.hamcrest.core.Is.is;
|
||||||
import static org.hamcrest.core.IsNull.notNullValue;
|
import static org.hamcrest.core.IsNull.notNullValue;
|
||||||
import static org.hamcrest.core.IsNull.nullValue;
|
import static org.hamcrest.core.IsNull.nullValue;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||||
|
@ -57,16 +56,6 @@ public class ClientModelTest extends AbstractKeycloakTest {
|
||||||
private String realmName="original";
|
private String realmName="original";
|
||||||
private KeycloakSession currentSession;
|
private KeycloakSession currentSession;
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, ClientModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isImportAfterEachMethod() {
|
protected boolean isImportAfterEachMethod() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,26 +17,24 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RoleModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,16 +44,6 @@ public class CompositeRolesModelTest extends AbstractTestRealmKeycloakTest {
|
||||||
@Rule
|
@Rule
|
||||||
public ExpectedException expectedException = ExpectedException.none();
|
public ExpectedException expectedException = ExpectedException.none();
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, CompositeRolesModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Set<RoleModel> getRequestedRoles(ClientModel application, UserModel user) {
|
public static Set<RoleModel> getRequestedRoles(ClientModel application, UserModel user) {
|
||||||
|
|
||||||
Set<RoleModel> requestedRoles = new HashSet<>();
|
Set<RoleModel> requestedRoles = new HashSet<>();
|
||||||
|
|
|
@ -17,29 +17,29 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.KeycloakSessionFactory;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RealmProvider;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -47,15 +47,6 @@ public class ConcurrentTransactionsTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
private static final int LATCH_TIMEOUT_MS = 30000;
|
private static final int LATCH_TIMEOUT_MS = 30000;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserSessionProviderOfflineTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ConcurrentTransactionsTest.class);
|
private static final Logger logger = Logger.getLogger(ConcurrentTransactionsTest.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.credential.CredentialModel;
|
import org.keycloak.credential.CredentialModel;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
|
@ -18,25 +11,15 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class CredentialModelTest extends AbstractTestRealmKeycloakTest {
|
public class CredentialModelTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model",
|
|
||||||
"com.google.common");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,10 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.KeycloakSessionFactory;
|
import org.keycloak.models.KeycloakSessionFactory;
|
||||||
import org.keycloak.models.dblock.DBLockManager;
|
import org.keycloak.models.dblock.DBLockManager;
|
||||||
|
@ -34,28 +30,16 @@ import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class DBLockTest extends AbstractTestRealmKeycloakTest {
|
public class DBLockTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, DBLockTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(DBLockTest.class);
|
private static final Logger log = Logger.getLogger(DBLockTest.class);
|
||||||
|
|
||||||
private static final int SLEEP_TIME_MILLIS = 10;
|
private static final int SLEEP_TIME_MILLIS = 10;
|
||||||
|
|
|
@ -17,16 +17,12 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.ClassRule;
|
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.constants.KerberosConstants;
|
import org.keycloak.common.constants.KerberosConstants;
|
||||||
|
import org.keycloak.models.Constants;
|
||||||
import org.keycloak.models.ProtocolMapperModel;
|
import org.keycloak.models.ProtocolMapperModel;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.RequiredCredentialModel;
|
import org.keycloak.models.RequiredCredentialModel;
|
||||||
|
@ -34,17 +30,12 @@ import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.protocol.oidc.mappers.OIDCAttributeMapperHelper;
|
import org.keycloak.protocol.oidc.mappers.OIDCAttributeMapperHelper;
|
||||||
import org.keycloak.protocol.oidc.mappers.UserSessionNoteMapper;
|
import org.keycloak.protocol.oidc.mappers.UserSessionNoteMapper;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.models.Constants;
|
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.federation.ldap.AbstractLDAPTest;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.LDAPRule;
|
|
||||||
|
|
||||||
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.keycloak.testsuite.admin.AbstractAdminTest.loadJson;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
@ -53,16 +44,6 @@ import java.util.List;
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class ImportTest extends AbstractTestRealmKeycloakTest {
|
public class ImportTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, ImportTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void demoDelete() throws Exception {
|
public void demoDelete() throws Exception {
|
||||||
// was having trouble deleting this realm from admin console
|
// was having trouble deleting this realm from admin console
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.common.Version;
|
import org.keycloak.common.Version;
|
||||||
|
@ -11,19 +9,12 @@ import org.keycloak.migration.MigrationModel;
|
||||||
import org.keycloak.models.jpa.entities.MigrationModelEntity;
|
import org.keycloak.models.jpa.entities.MigrationModelEntity;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerTest;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MigrationModelTest extends AbstractKeycloakTest {
|
public class MigrationModelTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(MigrationModelTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,37 +17,27 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RoleModel;
|
||||||
|
import org.keycloak.models.UserCredentialModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class MultipleRealmsTest extends AbstractTestRealmKeycloakTest {
|
public class MultipleRealmsTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, MultipleRealmsTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createObjects(KeycloakSession session, RealmModel realm) {
|
public static void createObjects(KeycloakSession session, RealmModel realm) {
|
||||||
ClientModel app1 = realm.addClient("app1");
|
ClientModel app1 = realm.addClient("app1");
|
||||||
realm.addClient("app2");
|
realm.addClient("app2");
|
||||||
|
|
|
@ -17,14 +17,8 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
|
@ -32,27 +26,15 @@ import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.services.managers.RealmManager;
|
import org.keycloak.services.managers.RealmManager;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerException;
|
import org.keycloak.testsuite.runonserver.RunOnServerException;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class SimpleModelTest extends AbstractKeycloakTest {
|
public class SimpleModelTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, SimpleModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,16 +17,19 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.ClientScopeModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.ModelException;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserConsentModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
@ -35,13 +38,10 @@ import org.keycloak.storage.client.ClientStorageProviderModel;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.federation.HardcodedClientStorageProviderFactory;
|
import org.keycloak.testsuite.federation.HardcodedClientStorageProviderFactory;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -49,15 +49,6 @@ public class UserConsentModelTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
private static ComponentModel clientStorageComponent;
|
private static ComponentModel clientStorageComponent;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserConsentModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
|
|
|
@ -17,16 +17,19 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.component.ComponentModel;
|
import org.keycloak.component.ComponentModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.ClientScopeModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.ModelException;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserConsentModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
@ -37,28 +40,17 @@ import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.federation.HardcodedClientStorageProviderFactory;
|
import org.keycloak.testsuite.federation.HardcodedClientStorageProviderFactory;
|
||||||
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
import org.keycloak.testsuite.federation.UserMapStorageFactory;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
import static org.keycloak.storage.UserStorageProviderModel.IMPORT_ENABLED;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class UserConsentWithUserStorageModelTest extends AbstractTestRealmKeycloakTest {
|
public class UserConsentWithUserStorageModelTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserConsentWithUserStorageModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ComponentModel clientStorageComponent;
|
private static ComponentModel clientStorageComponent;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -17,14 +17,13 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
import org.keycloak.models.ClientModel;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RoleModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.UserModel.RequiredAction;
|
import org.keycloak.models.UserModel.RequiredAction;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
@ -32,10 +31,13 @@ import org.keycloak.services.managers.ClientManager;
|
||||||
import org.keycloak.services.managers.RealmManager;
|
import org.keycloak.services.managers.RealmManager;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.contains;
|
import static org.hamcrest.Matchers.contains;
|
||||||
|
@ -45,23 +47,12 @@ import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||||
*/
|
*/
|
||||||
public class UserModelTest extends AbstractTestRealmKeycloakTest {
|
public class UserModelTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserModelTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model",
|
|
||||||
"com.google.common");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||||
testRealms.add(RealmBuilder.create().name("original").build());
|
testRealms.add(RealmBuilder.create().name("original").build());
|
||||||
|
@ -321,11 +312,9 @@ public class UserModelTest extends AbstractTestRealmKeycloakTest {
|
||||||
KeycloakSession currentSession = sesUpdateUserSingleAtr;
|
KeycloakSession currentSession = sesUpdateUserSingleAtr;
|
||||||
RealmModel realm = currentSession.realms().getRealmByName("original");
|
RealmModel realm = currentSession.realms().getRealmByName("original");
|
||||||
|
|
||||||
|
Map<String, List<String>> expected = new HashMap<>();
|
||||||
Map<String, List<String>> expected = ImmutableMap.of(
|
expected.put("key1", Arrays.asList("value3"));
|
||||||
"key1", Arrays.asList("value3"),
|
expected.put("key2", Arrays.asList("value2"));
|
||||||
"key2", Arrays.asList("value2"));
|
|
||||||
expectedAtomic.set(expected);
|
|
||||||
|
|
||||||
UserModel user = currentSession.users().addUser(realm, "user");
|
UserModel user = currentSession.users().addUser(realm, "user");
|
||||||
|
|
||||||
|
@ -336,6 +325,8 @@ public class UserModelTest extends AbstractTestRealmKeycloakTest {
|
||||||
user.setSingleAttribute("key1", "value3");
|
user.setSingleAttribute("key1", "value3");
|
||||||
|
|
||||||
Assert.assertThat(user.getAttributes(), equalTo(expected));
|
Assert.assertThat(user.getAttributes(), equalTo(expected));
|
||||||
|
|
||||||
|
expectedAtomic.set(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesUpdateUserSingleAtr2) -> {
|
KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesUpdateUserSingleAtr2) -> {
|
||||||
|
|
|
@ -17,31 +17,33 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
|
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.AuthenticatedClientSessionModel;
|
||||||
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.models.UserSessionModel;
|
||||||
|
import org.keycloak.models.UserSessionProvider;
|
||||||
|
import org.keycloak.models.UserSessionProviderFactory;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.services.managers.UserSessionManager;
|
import org.keycloak.services.managers.UserSessionManager;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.hamcrest.core.Is.is;
|
import static org.hamcrest.core.Is.is;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
|
@ -50,15 +52,6 @@ import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SE
|
||||||
public class UserSessionInitializerTest extends AbstractTestRealmKeycloakTest {
|
public class UserSessionInitializerTest extends AbstractTestRealmKeycloakTest {
|
||||||
private final String realmName = "test";
|
private final String realmName = "test";
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, org.keycloak.testsuite.model.UserSessionInitializerTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
|
|
|
@ -17,13 +17,18 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.junit.After;
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
import org.junit.Assert;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
import org.junit.Before;
|
||||||
import org.junit.*;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.AuthenticatedClientSessionModel;
|
||||||
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.models.UserSessionModel;
|
||||||
import org.keycloak.models.session.UserSessionPersisterProvider;
|
import org.keycloak.models.session.UserSessionPersisterProvider;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.models.utils.ResetTimeOffsetEvent;
|
import org.keycloak.models.utils.ResetTimeOffsetEvent;
|
||||||
|
@ -33,33 +38,20 @@ import org.keycloak.services.managers.ClientManager;
|
||||||
import org.keycloak.services.managers.RealmManager;
|
import org.keycloak.services.managers.RealmManager;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
public class UserSessionPersisterProviderTest extends AbstractTestRealmKeycloakTest {
|
public class UserSessionPersisterProviderTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserSessionPersisterProvider.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
|
|
|
@ -17,16 +17,18 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.AuthenticatedClientSessionModel;
|
||||||
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.models.UserSessionModel;
|
||||||
import org.keycloak.models.session.UserSessionPersisterProvider;
|
import org.keycloak.models.session.UserSessionPersisterProvider;
|
||||||
import org.keycloak.models.sessions.infinispan.changes.sessions.PersisterLastSessionRefreshStoreFactory;
|
import org.keycloak.models.sessions.infinispan.changes.sessions.PersisterLastSessionRefreshStoreFactory;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
|
@ -38,15 +40,17 @@ import org.keycloak.services.managers.RealmManager;
|
||||||
import org.keycloak.services.managers.UserSessionManager;
|
import org.keycloak.services.managers.UserSessionManager;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.timer.TimerProvider;
|
import org.keycloak.timer.TimerProvider;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
|
@ -57,15 +61,6 @@ public class UserSessionProviderOfflineTest extends AbstractTestRealmKeycloakTes
|
||||||
private static UserSessionManager sessionManager;
|
private static UserSessionManager sessionManager;
|
||||||
private static UserSessionPersisterProvider persister;
|
private static UserSessionPersisterProvider persister;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserSessionProviderOfflineTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() {
|
public void before() {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
|
|
|
@ -17,17 +17,20 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.model;
|
package org.keycloak.testsuite.model;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.container.test.api.TargetsContainer;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.util.Time;
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.AuthenticatedClientSessionModel;
|
||||||
import org.keycloak.models.sessions.infinispan.entities.UserSessionEntity;
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.KeycloakTransaction;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.UserLoginFailureModel;
|
||||||
|
import org.keycloak.models.UserManager;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
|
import org.keycloak.models.UserSessionModel;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.models.utils.ResetTimeOffsetEvent;
|
import org.keycloak.models.utils.ResetTimeOffsetEvent;
|
||||||
import org.keycloak.models.utils.SessionTimeoutHelper;
|
import org.keycloak.models.utils.SessionTimeoutHelper;
|
||||||
|
@ -35,28 +38,27 @@ import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertSame;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||||
*/
|
*/
|
||||||
public class UserSessionProviderTest extends AbstractTestRealmKeycloakTest {
|
public class UserSessionProviderTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
@TargetsContainer(AUTH_SERVER_CURRENT)
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class, UserSessionProviderTest.class)
|
|
||||||
.addPackages(true,
|
|
||||||
"org.keycloak.testsuite",
|
|
||||||
"org.keycloak.testsuite.model");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void setupRealm(KeycloakSession session){
|
public static void setupRealm(KeycloakSession session){
|
||||||
RealmModel realm = session.realms().getRealmByName("test");
|
RealmModel realm = session.realms().getRealmByName("test");
|
||||||
UserModel user1 = session.users().addUser(realm, "user1");
|
UserModel user1 = session.users().addUser(realm, "user1");
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.oauth;
|
package org.keycloak.testsuite.oauth;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
|
@ -28,7 +24,13 @@ import org.keycloak.TokenVerifier;
|
||||||
import org.keycloak.authorization.model.Policy;
|
import org.keycloak.authorization.model.Policy;
|
||||||
import org.keycloak.authorization.model.ResourceServer;
|
import org.keycloak.authorization.model.ResourceServer;
|
||||||
import org.keycloak.common.Profile;
|
import org.keycloak.common.Profile;
|
||||||
import org.keycloak.models.*;
|
import org.keycloak.models.ClientModel;
|
||||||
|
import org.keycloak.models.ImpersonationConstants;
|
||||||
|
import org.keycloak.models.KeycloakSession;
|
||||||
|
import org.keycloak.models.RealmModel;
|
||||||
|
import org.keycloak.models.RoleModel;
|
||||||
|
import org.keycloak.models.UserCredentialModel;
|
||||||
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.protocol.oidc.mappers.UserSessionNoteMapper;
|
import org.keycloak.protocol.oidc.mappers.UserSessionNoteMapper;
|
||||||
import org.keycloak.representations.AccessToken;
|
import org.keycloak.representations.AccessToken;
|
||||||
|
@ -41,11 +43,9 @@ import org.keycloak.services.resources.admin.permissions.AdminPermissions;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.AssertEvents;
|
import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.ProfileAssume;
|
|
||||||
import org.keycloak.testsuite.arquillian.annotation.DisableFeature;
|
import org.keycloak.testsuite.arquillian.annotation.DisableFeature;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;
|
import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.util.BasicAuthHelper;
|
import org.keycloak.util.BasicAuthHelper;
|
||||||
|
|
||||||
|
@ -74,11 +74,6 @@ public class ClientTokenExchangeTest extends AbstractKeycloakTest {
|
||||||
@Rule
|
@Rule
|
||||||
public AssertEvents events = new AssertEvents(this);
|
public AssertEvents events = new AssertEvents(this);
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(ClientTokenExchangeTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UncaughtServerErrorExpected
|
@UncaughtServerErrorExpected
|
||||||
@DisableFeature(value = Profile.Feature.TOKEN_EXCHANGE, skipRestart = true)
|
@DisableFeature(value = Profile.Feature.TOKEN_EXCHANGE, skipRestart = true)
|
||||||
|
|
|
@ -30,8 +30,6 @@ import org.apache.http.impl.client.BasicCookieStore;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.message.BasicNameValuePair;
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.ClientResource;
|
import org.keycloak.admin.client.resource.ClientResource;
|
||||||
import org.keycloak.models.Constants;
|
import org.keycloak.models.Constants;
|
||||||
|
@ -39,7 +37,6 @@ import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.ActionURIUtils;
|
import org.keycloak.testsuite.ActionURIUtils;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.runonserver.ServerVersion;
|
import org.keycloak.testsuite.runonserver.ServerVersion;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -58,11 +55,6 @@ import static org.junit.Assert.assertTrue;
|
||||||
*/
|
*/
|
||||||
public class LoginStatusIframeEndpointTest extends AbstractKeycloakTest {
|
public class LoginStatusIframeEndpointTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(LoginStatusIframeEndpointTest.class, ServerVersion.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkIframe() throws IOException {
|
public void checkIframe() throws IOException {
|
||||||
CookieStore cookieStore = new BasicCookieStore();
|
CookieStore cookieStore = new BasicCookieStore();
|
||||||
|
|
|
@ -16,9 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.oauth;
|
package org.keycloak.testsuite.oauth;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
|
@ -41,12 +39,10 @@ import org.keycloak.representations.AccessToken;
|
||||||
import org.keycloak.representations.RefreshToken;
|
import org.keycloak.representations.RefreshToken;
|
||||||
import org.keycloak.representations.idm.EventRepresentation;
|
import org.keycloak.representations.idm.EventRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractAuthTest;
|
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.AssertEvents;
|
import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientManager;
|
import org.keycloak.testsuite.util.ClientManager;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
|
@ -64,7 +60,6 @@ import javax.ws.rs.core.Form;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.UriBuilder;
|
import javax.ws.rs.core.UriBuilder;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -86,13 +81,6 @@ import static org.keycloak.testsuite.util.OAuthClient.AUTH_SERVER_ROOT;
|
||||||
*/
|
*/
|
||||||
public class RefreshTokenTest extends AbstractKeycloakTest {
|
public class RefreshTokenTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(RefreshTokenTest.class, AbstractAuthTest.class, RealmResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Page
|
@Page
|
||||||
protected LoginPage loginPage;
|
protected LoginPage loginPage;
|
||||||
|
|
||||||
|
|
|
@ -17,19 +17,10 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.oidc;
|
package org.keycloak.testsuite.oidc;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.resource.ClientResource;
|
import org.keycloak.admin.client.resource.ClientResource;
|
||||||
import org.keycloak.admin.client.resource.ClientScopeResource;
|
import org.keycloak.admin.client.resource.ClientScopeResource;
|
||||||
import org.keycloak.events.Details;
|
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.representations.JsonWebToken;
|
import org.keycloak.representations.JsonWebToken;
|
||||||
|
@ -40,13 +31,16 @@ import org.keycloak.representations.idm.ProtocolMapperRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ProtocolMapperUtil;
|
import org.keycloak.testsuite.util.ProtocolMapperUtil;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for the 'aud' claim in tokens
|
* Test for the 'aud' claim in tokens
|
||||||
*
|
*
|
||||||
|
@ -54,11 +48,6 @@ import org.keycloak.testsuite.util.UserBuilder;
|
||||||
*/
|
*/
|
||||||
public class AudienceTest extends AbstractOIDCScopeTest {
|
public class AudienceTest extends AbstractOIDCScopeTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(OIDCAdvancedRequestParamsTest.class, AbstractTestRealmKeycloakTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String userId = KeycloakModelUtils.generateId();
|
private static String userId = KeycloakModelUtils.generateId();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.keycloak.testsuite.oidc;
|
package org.keycloak.testsuite.oidc;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.security.PrivateKey;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -55,13 +48,17 @@ import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientManager;
|
import org.keycloak.testsuite.util.ClientManager;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.testsuite.util.OAuthClient.AccessTokenResponse;
|
import org.keycloak.testsuite.util.OAuthClient.AccessTokenResponse;
|
||||||
import org.keycloak.testsuite.util.TokenSignatureUtil;
|
import org.keycloak.testsuite.util.TokenSignatureUtil;
|
||||||
import org.keycloak.util.TokenUtil;
|
import org.keycloak.util.TokenUtil;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class IdTokenEncryptionTest extends AbstractTestRealmKeycloakTest {
|
public class IdTokenEncryptionTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
@ -82,11 +79,6 @@ public class IdTokenEncryptionTest extends AbstractTestRealmKeycloakTest {
|
||||||
@Page
|
@Page
|
||||||
protected ErrorPage errorPage;
|
protected ErrorPage errorPage;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(OIDCAdvancedRequestParamsTest.class, AbstractTestRealmKeycloakTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
package org.keycloak.testsuite.oidc;
|
package org.keycloak.testsuite.oidc;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -46,9 +44,9 @@ import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.representations.idm.EventRepresentation;
|
import org.keycloak.representations.idm.EventRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.services.util.CertificateInfoHelper;
|
import org.keycloak.services.util.CertificateInfoHelper;
|
||||||
|
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.AssertEvents;
|
import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.admin.AbstractAdminTest;
|
import org.keycloak.testsuite.admin.AbstractAdminTest;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.client.resources.TestApplicationResourceUrls;
|
import org.keycloak.testsuite.client.resources.TestApplicationResourceUrls;
|
||||||
|
@ -59,18 +57,16 @@ import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
||||||
import org.keycloak.testsuite.rest.resource.TestingOIDCEndpointsApplicationResource;
|
import org.keycloak.testsuite.rest.resource.TestingOIDCEndpointsApplicationResource;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientManager;
|
import org.keycloak.testsuite.util.ClientManager;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.util.JsonSerialization;
|
import org.keycloak.util.JsonSerialization;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.UriBuilder;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.core.UriBuilder;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
@ -100,11 +96,6 @@ public class OIDCAdvancedRequestParamsTest extends AbstractTestRealmKeycloakTest
|
||||||
@Page
|
@Page
|
||||||
protected ErrorPage errorPage;
|
protected ErrorPage errorPage;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(OIDCAdvancedRequestParamsTest.class, AbstractTestRealmKeycloakTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,7 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.oidc;
|
package org.keycloak.testsuite.oidc;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -38,7 +36,6 @@ import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientManager;
|
import org.keycloak.testsuite.util.ClientManager;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
|
|
||||||
|
@ -65,11 +62,6 @@ public class OIDCBackwardsCompatibilityTest extends AbstractTestRealmKeycloakTes
|
||||||
@Page
|
@Page
|
||||||
protected ErrorPage errorPage;
|
protected ErrorPage errorPage;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(OIDCBackwardsCompatibilityTest.class, AbstractTestRealmKeycloakTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,6 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.oidc;
|
package org.keycloak.testsuite.oidc;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ws.rs.NotFoundException;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -50,16 +41,20 @@ import org.keycloak.representations.idm.GroupRepresentation;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.RoleRepresentation;
|
import org.keycloak.representations.idm.RoleRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.Assert;
|
import org.keycloak.testsuite.Assert;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
import org.keycloak.testsuite.pages.OAuthGrantPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ClientManager;
|
import org.keycloak.testsuite.util.ClientManager;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
import org.keycloak.testsuite.util.RoleBuilder;
|
import org.keycloak.testsuite.util.RoleBuilder;
|
||||||
import org.keycloak.testsuite.util.UserBuilder;
|
import org.keycloak.testsuite.util.UserBuilder;
|
||||||
|
|
||||||
|
import javax.ws.rs.NotFoundException;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,11 +64,6 @@ import static org.junit.Assert.assertEquals;
|
||||||
*/
|
*/
|
||||||
public class OIDCScopeTest extends AbstractOIDCScopeTest {
|
public class OIDCScopeTest extends AbstractOIDCScopeTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(OIDCAdvancedRequestParamsTest.class, AbstractTestRealmKeycloakTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String userId = KeycloakModelUtils.generateId();
|
private static String userId = KeycloakModelUtils.generateId();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,22 +17,10 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.openshift;
|
package org.keycloak.testsuite.openshift;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
import static org.keycloak.common.Profile.Feature.OPENSHIFT_INTEGRATION;
|
|
||||||
import static org.keycloak.testsuite.admin.ApiUtil.findUserByUsername;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import io.undertow.Undertow;
|
import io.undertow.Undertow;
|
||||||
import io.undertow.server.HttpHandler;
|
import io.undertow.server.HttpHandler;
|
||||||
import io.undertow.server.HttpServerExchange;
|
import io.undertow.server.HttpServerExchange;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -42,7 +30,6 @@ import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.OAuthErrorException;
|
import org.keycloak.OAuthErrorException;
|
||||||
import org.keycloak.admin.client.resource.ComponentResource;
|
import org.keycloak.admin.client.resource.ComponentResource;
|
||||||
import org.keycloak.admin.client.resource.UserResource;
|
|
||||||
import org.keycloak.common.util.MultivaluedHashMap;
|
import org.keycloak.common.util.MultivaluedHashMap;
|
||||||
import org.keycloak.common.util.StreamUtil;
|
import org.keycloak.common.util.StreamUtil;
|
||||||
import org.keycloak.events.Details;
|
import org.keycloak.events.Details;
|
||||||
|
@ -56,15 +43,22 @@ import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
|
||||||
import org.keycloak.testsuite.AssertEvents;
|
import org.keycloak.testsuite.AssertEvents;
|
||||||
import org.keycloak.testsuite.admin.ApiUtil;
|
import org.keycloak.testsuite.admin.ApiUtil;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
import org.keycloak.testsuite.arquillian.annotation.EnableFeature;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.RestartContainer;
|
|
||||||
import org.keycloak.testsuite.pages.AppPage;
|
import org.keycloak.testsuite.pages.AppPage;
|
||||||
import org.keycloak.testsuite.pages.ConsentPage;
|
import org.keycloak.testsuite.pages.ConsentPage;
|
||||||
import org.keycloak.testsuite.pages.ErrorPage;
|
import org.keycloak.testsuite.pages.ErrorPage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ContainerAssume;
|
import org.keycloak.testsuite.util.ContainerAssume;
|
||||||
import org.keycloak.testsuite.util.OAuthClient;
|
import org.keycloak.testsuite.util.OAuthClient;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.keycloak.common.Profile.Feature.OPENSHIFT_INTEGRATION;
|
||||||
|
import static org.keycloak.testsuite.admin.ApiUtil.findUserByUsername;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that clients can override auth flows
|
* Test that clients can override auth flows
|
||||||
*
|
*
|
||||||
|
@ -93,12 +87,6 @@ public final class OpenshiftClientStorageTest extends AbstractTestRealmKeycloakT
|
||||||
private String userId;
|
private String userId;
|
||||||
private String clientStorageId;
|
private String clientStorageId;
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(UserResource.class)
|
|
||||||
.addPackages(true, "org.keycloak.testsuite");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureTestRealm(RealmRepresentation testRealm) {
|
public void configureTestRealm(RealmRepresentation testRealm) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.policy;
|
package org.keycloak.testsuite.policy;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.models.ModelException;
|
import org.keycloak.models.ModelException;
|
||||||
|
@ -28,7 +26,6 @@ import org.keycloak.policy.BlacklistPasswordPolicyProvider;
|
||||||
import org.keycloak.policy.PasswordPolicyManagerProvider;
|
import org.keycloak.policy.PasswordPolicyManagerProvider;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
|
|
||||||
import org.keycloak.testsuite.util.ContainerAssume;
|
import org.keycloak.testsuite.util.ContainerAssume;
|
||||||
import org.keycloak.testsuite.util.RealmBuilder;
|
import org.keycloak.testsuite.util.RealmBuilder;
|
||||||
|
|
||||||
|
@ -45,11 +42,6 @@ import static org.junit.Assert.fail;
|
||||||
*/
|
*/
|
||||||
public class PasswordPolicyTest extends AbstractKeycloakTest {
|
public class PasswordPolicyTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLength() {
|
public void testLength() {
|
||||||
testingClient.server("passwordPolicy").run(session -> {
|
testingClient.server("passwordPolicy").run(session -> {
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package org.keycloak.testsuite.runonserver;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
|
||||||
import org.keycloak.testsuite.runonserver.RunOnServerException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by st on 26.01.17.
|
|
||||||
*/
|
|
||||||
public class RunOnServerDeployment {
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive create(Class<?> ... classes) {
|
|
||||||
return ShrinkWrap.create(WebArchive.class, "run-on-server-classes.war")
|
|
||||||
.addAsManifestResource("run-on-server-jboss-deployment-structure.xml","jboss-deployment-structure.xml")
|
|
||||||
.addClasses(classes)
|
|
||||||
.addClass(AbstractKeycloakTest.class)
|
|
||||||
.addClass(RunOnServerException.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.runonserver;
|
package org.keycloak.testsuite.runonserver;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.junit.ComparisonFailure;
|
import org.junit.ComparisonFailure;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.models.ModelException;
|
import org.keycloak.models.ModelException;
|
||||||
|
@ -30,7 +28,9 @@ import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This checks running code on the server for tests works and is not a test of the actual server
|
* This checks running code on the server for tests works and is not a test of the actual server
|
||||||
|
@ -39,19 +39,14 @@ import static org.junit.Assert.*;
|
||||||
*/
|
*/
|
||||||
public class RunOnServerTest extends AbstractKeycloakTest {
|
public class RunOnServerTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive deploy() {
|
|
||||||
return RunOnServerDeployment.create(RunOnServerTest.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runOnServerString() throws IOException {
|
public void runOnServerString() {
|
||||||
String string = testingClient.server().fetch(session -> "Hello world!", String.class);
|
String string = testingClient.server().fetch(session -> "Hello world!", String.class);
|
||||||
assertEquals("Hello world!", string);
|
assertEquals("Hello world!", string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runOnServerRep() throws IOException {
|
public void runOnServerRep() {
|
||||||
final String realmName = "master";
|
final String realmName = "master";
|
||||||
|
|
||||||
RealmRepresentation realmRep = testingClient.server().fetch(session -> {
|
RealmRepresentation realmRep = testingClient.server().fetch(session -> {
|
||||||
|
@ -63,18 +58,18 @@ public class RunOnServerTest extends AbstractKeycloakTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runOnServerHelpers() throws IOException {
|
public void runOnServerHelpers() {
|
||||||
RealmRepresentation realmRep = testingClient.server().fetch(RunHelpers.internalRealm());
|
RealmRepresentation realmRep = testingClient.server().fetch(RunHelpers.internalRealm());
|
||||||
assertEquals("master", realmRep.getRealm());
|
assertEquals("master", realmRep.getRealm());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runOnServerNoResponse() throws IOException {
|
public void runOnServerNoResponse() {
|
||||||
testingClient.server().run(session -> System.out.println("Hello world!"));
|
testingClient.server().run(session -> System.out.println("Hello world!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runOnServerAssertOnServer() throws IOException {
|
public void runOnServerAssertOnServer() {
|
||||||
try {
|
try {
|
||||||
testingClient.server().run(session -> assertEquals("foo", "bar"));
|
testingClient.server().run(session -> assertEquals("foo", "bar"));
|
||||||
fail("Expected exception");
|
fail("Expected exception");
|
||||||
|
@ -84,7 +79,7 @@ public class RunOnServerTest extends AbstractKeycloakTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runOnServerExceptionOnServer() throws IOException {
|
public void runOnServerExceptionOnServer() {
|
||||||
try {
|
try {
|
||||||
testingClient.server().run(session -> {
|
testingClient.server().run(session -> {
|
||||||
throw new ModelException("Something went wrong");
|
throw new ModelException("Something went wrong");
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue