commit
89c89b4867
3 changed files with 53 additions and 16 deletions
|
@ -48,6 +48,7 @@
|
|||
<button onclick="refreshTimeSkew()">refresh timeSkew</button>
|
||||
<button onclick="sendBearerToKeycloak()">Bearer to keycloak</button>
|
||||
<button onclick="createUser()">Create user</button>
|
||||
<button onclick="reentrancyCallback()">Reentrancy callback</button>
|
||||
|
||||
|
||||
<select id="flowSelect">
|
||||
|
@ -72,7 +73,8 @@
|
|||
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px;" id="events"></pre>
|
||||
|
||||
<h2>Info</h2>
|
||||
TimeSkew: <div id="timeSkew"></div>
|
||||
TimeSkew:
|
||||
<div id="timeSkew"></div>
|
||||
|
||||
|
||||
<script>
|
||||
|
@ -194,6 +196,9 @@ TimeSkew: <div id="timeSkew"></div>
|
|||
if (window.location.href.indexOf("8643") > -1) {
|
||||
url = url.replace("8180","8543");
|
||||
url = url.replace("http","https");
|
||||
if (window.location.href.indexOf("8543") > -1) {
|
||||
url = url.replace("8180", "8543");
|
||||
url = url.replace("http", "https");
|
||||
}
|
||||
|
||||
var req = new XMLHttpRequest();
|
||||
|
@ -269,6 +274,16 @@ TimeSkew: <div id="timeSkew"></div>
|
|||
req.send(JSON.stringify(user));
|
||||
}
|
||||
|
||||
function reentrancyCallback() {
|
||||
keycloak.updateToken(60).success(function () {
|
||||
event("First callback");
|
||||
keycloak.updateToken(60).success(function () {
|
||||
event("Second callback")
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var keycloak;
|
||||
|
||||
function keycloakInit() {
|
||||
|
@ -299,7 +314,11 @@ TimeSkew: <div id="timeSkew"></div>
|
|||
event('Access token expired.');
|
||||
};
|
||||
|
||||
var initOptions = {onLoad: document.getElementById("onLoad").value, flow: document.getElementById("flowSelect").value, responseMode: document.getElementById("responseModeSelect").value};
|
||||
var initOptions = {
|
||||
onLoad: document.getElementById("onLoad").value,
|
||||
flow: document.getElementById("flowSelect").value,
|
||||
responseMode: document.getElementById("responseModeSelect").value
|
||||
};
|
||||
keycloak.init(initOptions).success(function (authenticated) {
|
||||
output('Init Success (' + (authenticated ? 'Authenticated' : 'Not Authenticated') + ')');
|
||||
}).error(function () {
|
||||
|
|
|
@ -83,6 +83,8 @@ public class JSConsoleTestApp extends AbstractPageWithInjectedUrl {
|
|||
private WebElement refreshTimeSkewButton;
|
||||
@FindBy(xpath = "//button[text() = 'Create user']")
|
||||
private WebElement createUserButton;
|
||||
@FindBy(xpath = "//button[text() = 'Reentrancy callback']")
|
||||
private WebElement reentrancyCallbackButton;
|
||||
|
||||
@FindBy(id = "timeSkew")
|
||||
private WebElement timeSkewValue;
|
||||
|
@ -190,4 +192,8 @@ public class JSConsoleTestApp extends AbstractPageWithInjectedUrl {
|
|||
public void sendCertRequest() {
|
||||
certRequestButton.click();
|
||||
}
|
||||
|
||||
public void callReentrancyCallback() {
|
||||
reentrancyCallbackButton.click();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -454,6 +454,18 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
|
|||
.contains("location: " + authServerContextRootPage.toString() + "/auth/admin/realms/" + EXAMPLE + "/users/" + users.get(0).getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void reentrancyCallbackTest() {
|
||||
logInAndInit("standard");
|
||||
|
||||
jsConsoleTestAppPage.callReentrancyCallback();
|
||||
|
||||
waitUntilElement(jsConsoleTestAppPage.getEventsElement()).text().contains("First callback");
|
||||
waitUntilElement(jsConsoleTestAppPage.getEventsElement()).text().contains("Second callback");
|
||||
|
||||
waitUntilElement(jsConsoleTestAppPage.getEventsElement()).text().not().contains("Auth Logout");
|
||||
}
|
||||
|
||||
private void setImplicitFlowForClient() {
|
||||
ClientResource clientResource = ApiUtil.findClientResourceByClientId(testRealmResource(), "js-console");
|
||||
ClientRepresentation client = clientResource.toRepresentation();
|
||||
|
|
Loading…
Reference in a new issue