From b52801de25a3cbf1fdfa94be6ac21491d61c70d7 Mon Sep 17 00:00:00 2001 From: Lee Newson Date: Sat, 31 May 2014 10:09:42 +1000 Subject: [PATCH 1/2] Fixed an integer overflow that caused the token to always be refreshed --- .../java/org/keycloak/adapters/installed/KeycloakInstalled.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/installed/src/main/java/org/keycloak/adapters/installed/KeycloakInstalled.java b/integration/installed/src/main/java/org/keycloak/adapters/installed/KeycloakInstalled.java index 02304c056c..32ebfdbf6d 100644 --- a/integration/installed/src/main/java/org/keycloak/adapters/installed/KeycloakInstalled.java +++ b/integration/installed/src/main/java/org/keycloak/adapters/installed/KeycloakInstalled.java @@ -173,7 +173,7 @@ public class KeycloakInstalled { } public String getTokenString(long minValidity, TimeUnit unit) throws VerificationException, IOException, ServerRequest.HttpFailure { - long expires = token.getExpiration() * 1000 - unit.toMillis(minValidity); + long expires = ((long) token.getExpiration()) * 1000 - unit.toMillis(minValidity); if (expires < System.currentTimeMillis()) { refreshToken(); } From 3bcf2c81dac5c73319b8823617e03a48be56f5c7 Mon Sep 17 00:00:00 2001 From: Lee Newson Date: Sat, 31 May 2014 10:39:34 +1000 Subject: [PATCH 2/2] Fixed an NPE when the users name is null --- .../main/java/org/keycloak/social/SocialUser.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/social/core/src/main/java/org/keycloak/social/SocialUser.java b/social/core/src/main/java/org/keycloak/social/SocialUser.java index 9a1faed3e6..ca9f987a63 100644 --- a/social/core/src/main/java/org/keycloak/social/SocialUser.java +++ b/social/core/src/main/java/org/keycloak/social/SocialUser.java @@ -34,12 +34,14 @@ public class SocialUser { } public void setName(String name) { - int i = name.lastIndexOf(' '); - if (i != -1) { - firstName = name.substring(0, i); - lastName = name.substring(i + 1); - } else { - firstName = name; + if (name != null) { + int i = name.lastIndexOf(' '); + if (i != -1) { + firstName = name.substring(0, i); + lastName = name.substring(i + 1); + } else { + firstName = name; + } } }