KEYCLOAK-4691: Extract iat generator to method

This commit is contained in:
sebastienblanc 2017-03-30 10:51:28 +02:00
parent 45ea3c8b47
commit 0e8337ba8e

View file

@ -54,6 +54,8 @@ public class TestsHelper {
public static String appName;
public static int initialAccessTokenCount = 2;
protected static String clientConfiguration;
protected static String registrationAccessCode;
@ -184,11 +186,7 @@ public class TestsHelper {
"admin-cli");
keycloak.realms().create(realmRepresentation);
testRealm = realmRepresentation.getRealm();
ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation();
rep.setCount(2);
rep.setExpiration(100);
ClientInitialAccessPresentation initialAccess = keycloak.realms().realm(testRealm).clientInitialAccess().create(rep);
initialAccessCode = initialAccess.getToken();
generateInitialAccessToken(keycloak);
return true;
}
@ -205,12 +203,16 @@ public class TestsHelper {
password,
"admin-cli");
keycloak.realms().create(realmRepresentation);
generateInitialAccessToken(keycloak);
return true;
}
private static void generateInitialAccessToken(Keycloak keycloak) {
ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation();
rep.setCount(2);
rep.setCount(initialAccessTokenCount);
rep.setExpiration(100);
ClientInitialAccessPresentation initialAccess = keycloak.realms().realm(testRealm).clientInitialAccess().create(rep);
initialAccessCode = initialAccess.getToken();
return true;
}
public static boolean deleteRealm(String username, String password, String realmName) throws IOException {