Disable session iframe in Corodova

This commit is contained in:
Stian Thorgersen 2014-05-28 17:29:13 +01:00
parent 2074e1423f
commit dd30a35e1e
3 changed files with 8 additions and 6 deletions

View file

@ -8,14 +8,11 @@
<script type="text/javascript" charset="utf-8">
var keycloak = new Keycloak();
keycloak.onReady = updateState;
keycloak.onAuthSuccess = updateState;
keycloak.onAuthRefreshSuccess = updateState;
keycloak.onAuthLogout = updateState;
function updateState() {
console.debug('Updating state');
if (keycloak.authenticated) {
document.getElementById('authenticated').style.display = 'block';
document.getElementById('not-authenticated').style.display = 'none';
@ -31,8 +28,6 @@
}
document.addEventListener("deviceready", function() {
console.debug('Device ready');
keycloak.init({ onLoad: 'check-sso' });
}, false);
</script>
@ -42,6 +37,7 @@
<div>
<button onclick="keycloak.logout()">Log out</button>
<button onclick="keycloak.updateToken()">Refresh token</button>
<button onclick="keycloak.updateToken(9999)">Force Refresh token</button>
<button onclick="keycloak.accountManagement()">Manage account</button>
</div>
<div>

View file

@ -617,6 +617,8 @@ var Keycloak = function (config) {
}
if (type == 'cordova') {
loginIframe.enable = false;
return {
login: function(options) {
var promise = createPromise();

View file

@ -128,7 +128,11 @@ public class RealmsResource {
}
for (String r : TokenService.resolveValidRedirects(uriInfo, client.getRedirectUris())) {
r = r.substring(0, r.indexOf('/', 8));
int i = r.indexOf('/', 8);
if (i != -1) {
r = r.substring(0, i);
}
if (r.equals(origin)) {
valid = true;
break;