KEYCLOAK-4691: Extract iat generator to method
This commit is contained in:
parent
45ea3c8b47
commit
0e8337ba8e
1 changed files with 9 additions and 7 deletions
|
@ -54,6 +54,8 @@ public class TestsHelper {
|
||||||
|
|
||||||
public static String appName;
|
public static String appName;
|
||||||
|
|
||||||
|
public static int initialAccessTokenCount = 2;
|
||||||
|
|
||||||
protected static String clientConfiguration;
|
protected static String clientConfiguration;
|
||||||
|
|
||||||
protected static String registrationAccessCode;
|
protected static String registrationAccessCode;
|
||||||
|
@ -184,11 +186,7 @@ public class TestsHelper {
|
||||||
"admin-cli");
|
"admin-cli");
|
||||||
keycloak.realms().create(realmRepresentation);
|
keycloak.realms().create(realmRepresentation);
|
||||||
testRealm = realmRepresentation.getRealm();
|
testRealm = realmRepresentation.getRealm();
|
||||||
ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation();
|
generateInitialAccessToken(keycloak);
|
||||||
rep.setCount(2);
|
|
||||||
rep.setExpiration(100);
|
|
||||||
ClientInitialAccessPresentation initialAccess = keycloak.realms().realm(testRealm).clientInitialAccess().create(rep);
|
|
||||||
initialAccessCode = initialAccess.getToken();
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,12 +203,16 @@ public class TestsHelper {
|
||||||
password,
|
password,
|
||||||
"admin-cli");
|
"admin-cli");
|
||||||
keycloak.realms().create(realmRepresentation);
|
keycloak.realms().create(realmRepresentation);
|
||||||
|
generateInitialAccessToken(keycloak);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void generateInitialAccessToken(Keycloak keycloak) {
|
||||||
ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation();
|
ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation();
|
||||||
rep.setCount(2);
|
rep.setCount(initialAccessTokenCount);
|
||||||
rep.setExpiration(100);
|
rep.setExpiration(100);
|
||||||
ClientInitialAccessPresentation initialAccess = keycloak.realms().realm(testRealm).clientInitialAccess().create(rep);
|
ClientInitialAccessPresentation initialAccess = keycloak.realms().realm(testRealm).clientInitialAccess().create(rep);
|
||||||
initialAccessCode = initialAccess.getToken();
|
initialAccessCode = initialAccess.getToken();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean deleteRealm(String username, String password, String realmName) throws IOException {
|
public static boolean deleteRealm(String username, String password, String realmName) throws IOException {
|
||||||
|
|
Loading…
Reference in a new issue