From 34c2c5a3a030e79999caa760ed1273ed693db8fd Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Tue, 15 Jun 2021 09:15:29 +0100 Subject: [PATCH] Fix group icon not displaying when validating groups (#141) --- .../com/microsoft/jenkins/azuread/AzureSecurityRealm.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java b/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java index 5ca33fdf..444e610e 100644 --- a/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java +++ b/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java @@ -498,7 +498,7 @@ public SecurityComponents createSecurityComponents() { }); if (azureAdUser == null) { - throw new UserMayOrMayNotExistException2("Cannot find user: " + username); + throw new UsernameNotFoundException("Cannot find user: " + username); } return azureAdUser; @@ -510,6 +510,10 @@ public SecurityComponents createSecurityComponents() { */ @Override public GroupDetails loadGroupByGroupname2(String groupName, boolean fetchMembers) { + if (isDisableGraphIntegration()) { + throw new UserMayOrMayNotExistException2("Can't lookup a group if graph integration is disabled"); + } + GraphServiceClient azureClient = getAzureClient(); String groupId = ObjId2FullSidMap.extractObjectId(groupName);