Simplified calling of AuthenticationManagementResource.getExecutions()
This commit is contained in:
parent
f6a718f10a
commit
afcdce6b71
6 changed files with 22 additions and 67 deletions
|
@ -100,7 +100,7 @@ public interface AuthenticationManagementResource {
|
|||
@Path("/flows/{flowAlias}/executions")
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
Response getExecutions(@PathParam("flowAlias") String flowAlias);
|
||||
List<AuthenticationExecutionInfoRepresentation> getExecutions(@PathParam("flowAlias") String flowAlias);
|
||||
|
||||
@Path("/flows/{flowAlias}/executions")
|
||||
@PUT
|
||||
|
|
|
@ -56,13 +56,7 @@ public abstract class AbstractCustomAccountManagementTest extends AbstractAccoun
|
|||
}
|
||||
|
||||
protected AuthenticationExecutionInfoRepresentation getExecution(String flowAlias, String provider) {
|
||||
Response response = authMgmtResource.getExecutions(flowAlias);
|
||||
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = response.readEntity(
|
||||
new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
|
||||
response.close();
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = authMgmtResource.getExecutions(flowAlias);
|
||||
|
||||
for (AuthenticationExecutionInfoRepresentation exec : executionReps) {
|
||||
if (provider.equals(exec.getProviderId())) {
|
||||
|
|
|
@ -348,14 +348,8 @@ public class UserFederationTest extends AbstractAdminTest {
|
|||
|
||||
private AuthenticationExecutionInfoRepresentation findKerberosExecution() {
|
||||
AuthenticationExecutionInfoRepresentation kerberosExecution = null;
|
||||
Response response = realm.flows().getExecutions("browser");
|
||||
try {
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
kerberosExecution = AbstractAuthenticationTest.findExecutionByProvider("auth-spnego", executionReps);
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = realm.flows().getExecutions("browser");
|
||||
kerberosExecution = AbstractAuthenticationTest.findExecutionByProvider("auth-spnego", executionReps);
|
||||
|
||||
Assert.assertNotNull(kerberosExecution);
|
||||
return kerberosExecution;
|
||||
|
|
|
@ -68,20 +68,12 @@ public class ExecutionTest extends AbstractAuthenticationTest {
|
|||
authMgmtResource.addExecution("Copy of browser", params);
|
||||
|
||||
// check execution was added
|
||||
response = authMgmtResource.getExecutions("Copy of browser");
|
||||
AuthenticationExecutionInfoRepresentation exec;
|
||||
AuthenticationExecutionInfoRepresentation authCookieExec;
|
||||
try {
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
exec = findExecutionByProvider("idp-review-profile", executionReps);
|
||||
Assert.assertNotNull("idp-review-profile added", exec);
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = authMgmtResource.getExecutions("Copy of browser");
|
||||
AuthenticationExecutionInfoRepresentation exec = findExecutionByProvider("idp-review-profile", executionReps);
|
||||
Assert.assertNotNull("idp-review-profile added", exec);
|
||||
|
||||
// we'll need auth-cookie later
|
||||
authCookieExec = findExecutionByProvider("auth-cookie", executionReps);
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
// we'll need auth-cookie later
|
||||
AuthenticationExecutionInfoRepresentation authCookieExec = findExecutionByProvider("auth-cookie", executionReps);
|
||||
|
||||
compareExecution(newExecInfo("Review Profile", "idp-review-profile", true, 0, 3, DISABLED, null, new String[]{REQUIRED, DISABLED}), exec);
|
||||
|
||||
|
@ -89,15 +81,9 @@ public class ExecutionTest extends AbstractAuthenticationTest {
|
|||
authMgmtResource.removeExecution(exec.getId());
|
||||
|
||||
// check execution was removed
|
||||
response = authMgmtResource.getExecutions("Copy of browser");
|
||||
try {
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
exec = findExecutionByProvider("idp-review-profile", executionReps);
|
||||
Assert.assertNull("idp-review-profile removed", exec);
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
executionReps = authMgmtResource.getExecutions("Copy of browser");
|
||||
exec = findExecutionByProvider("idp-review-profile", executionReps);
|
||||
Assert.assertNull("idp-review-profile removed", exec);
|
||||
|
||||
// now add the execution again using a different method and representation
|
||||
|
||||
|
@ -130,16 +116,9 @@ public class ExecutionTest extends AbstractAuthenticationTest {
|
|||
}
|
||||
|
||||
// check execution was added
|
||||
List<AuthenticationExecutionInfoRepresentation> executions;
|
||||
response = authMgmtResource.getExecutions("Copy of browser");
|
||||
try {
|
||||
executions = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
exec = findExecutionByProvider("auth-cookie", executions);
|
||||
Assert.assertNotNull("auth-cookie added", exec);
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
List<AuthenticationExecutionInfoRepresentation> executions = authMgmtResource.getExecutions("Copy of browser");
|
||||
exec = findExecutionByProvider("auth-cookie", executions);
|
||||
Assert.assertNotNull("auth-cookie added", exec);
|
||||
|
||||
// Note: there is no checking in addExecution if requirement is one of requirementChoices
|
||||
// Thus we can have OPTIONAL which is neither ALTERNATIVE, nor DISABLED
|
||||
|
@ -150,10 +129,7 @@ public class ExecutionTest extends AbstractAuthenticationTest {
|
|||
public void testUpdateExecution() {
|
||||
|
||||
// get current auth-cookie execution
|
||||
Response response = authMgmtResource.getExecutions("browser");
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = response.readEntity(
|
||||
new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = authMgmtResource.getExecutions("browser");
|
||||
AuthenticationExecutionInfoRepresentation exec = findExecutionByProvider("auth-cookie", executionReps);
|
||||
|
||||
Assert.assertEquals("auth-cookie set to ALTERNATIVE", ALTERNATIVE, exec.getRequirement());
|
||||
|
@ -163,8 +139,7 @@ public class ExecutionTest extends AbstractAuthenticationTest {
|
|||
authMgmtResource.updateExecutions("browser", exec);
|
||||
|
||||
// make sure the change is visible
|
||||
response = authMgmtResource.getExecutions("browser");
|
||||
executionReps = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {});
|
||||
executionReps = authMgmtResource.getExecutions("browser");
|
||||
|
||||
// get current auth-cookie execution
|
||||
AuthenticationExecutionInfoRepresentation exec2 = findExecutionByProvider("auth-cookie", executionReps);
|
||||
|
|
|
@ -55,9 +55,7 @@ public class InitialFlowsTest extends AbstractAuthenticationTest {
|
|||
List<AuthenticationFlowRepresentation> flows = authMgmtResource.getFlows();
|
||||
for (AuthenticationFlowRepresentation flow : flows) {
|
||||
// get all executions for flow
|
||||
Response executions = authMgmtResource.getExecutions(flow.getAlias());
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = executions.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
List<AuthenticationExecutionInfoRepresentation> executionReps = authMgmtResource.getExecutions(flow.getAlias());
|
||||
|
||||
for (AuthenticationExecutionInfoRepresentation exec : executionReps) {
|
||||
// separately load referenced configurations
|
||||
|
|
|
@ -45,9 +45,7 @@ public class ShiftExecutionTest extends AbstractAuthenticationTest {
|
|||
}
|
||||
|
||||
// get executions
|
||||
response = authMgmtResource.getExecutions("Copy of browser");
|
||||
List<AuthenticationExecutionInfoRepresentation> executions = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
List<AuthenticationExecutionInfoRepresentation> executions = authMgmtResource.getExecutions("Copy of browser");
|
||||
|
||||
AuthenticationExecutionInfoRepresentation last = executions.get(executions.size() - 1);
|
||||
AuthenticationExecutionInfoRepresentation oneButLast = executions.get(executions.size() - 2);
|
||||
|
@ -55,9 +53,7 @@ public class ShiftExecutionTest extends AbstractAuthenticationTest {
|
|||
// shift last execution up
|
||||
authMgmtResource.raisePriority(last.getId());
|
||||
|
||||
response = authMgmtResource.getExecutions("Copy of browser");
|
||||
List<AuthenticationExecutionInfoRepresentation> executions2 = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
List<AuthenticationExecutionInfoRepresentation> executions2 = authMgmtResource.getExecutions("Copy of browser");
|
||||
|
||||
AuthenticationExecutionInfoRepresentation last2 = executions2.get(executions.size() - 1);
|
||||
AuthenticationExecutionInfoRepresentation oneButLast2 = executions2.get(executions.size() - 2);
|
||||
|
@ -68,9 +64,7 @@ public class ShiftExecutionTest extends AbstractAuthenticationTest {
|
|||
// shift one before last down
|
||||
authMgmtResource.lowerPriority(oneButLast2.getId());
|
||||
|
||||
response = authMgmtResource.getExecutions("Copy of browser");
|
||||
executions2 = response.readEntity(new GenericType<List<AuthenticationExecutionInfoRepresentation>>() {
|
||||
});
|
||||
executions2 = authMgmtResource.getExecutions("Copy of browser");
|
||||
|
||||
last2 = executions2.get(executions.size() - 1);
|
||||
oneButLast2 = executions2.get(executions.size() - 2);
|
||||
|
|
Loading…
Reference in a new issue