From b158f851733b84a896b24a15edf07c0a0161d4bf Mon Sep 17 00:00:00 2001 From: Giuliano Mele Date: Wed, 5 Oct 2022 13:31:21 +0200 Subject: [PATCH] Fix first time device registration Fixes: #46 --- .../keycloak/trustdevice/model/SimpleTrustedDeviceManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/auth-trust-device/src/main/java/com/github/thomasdarimont/keycloak/trustdevice/model/SimpleTrustedDeviceManager.java b/auth-trust-device/src/main/java/com/github/thomasdarimont/keycloak/trustdevice/model/SimpleTrustedDeviceManager.java index cd26862..0ea762e 100644 --- a/auth-trust-device/src/main/java/com/github/thomasdarimont/keycloak/trustdevice/model/SimpleTrustedDeviceManager.java +++ b/auth-trust-device/src/main/java/com/github/thomasdarimont/keycloak/trustdevice/model/SimpleTrustedDeviceManager.java @@ -15,6 +15,9 @@ public TrustedDeviceModel lookupTrustedDevice(KeycloakSession session, RealmMode TrustedDeviceRepository repo = new TrustedDeviceRepository(session); TrustedDeviceEntity entity = repo.lookupTrustedDevice(realm.getId(), user.getId(), deviceId); + if (entity == null) { + return null; + } return toModel(entity); }