[KEYCLOAK-3900] - SSSD Provider: NullPointerException when SSSD is stopped
This commit is contained in:
parent
6c64494620
commit
b612415a88
2 changed files with 20 additions and 3 deletions
|
@ -0,0 +1,17 @@
|
||||||
|
package org.keycloak.federation.sssd.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:bruno@abstractj.org">Bruno Oliveira</a>
|
||||||
|
*/
|
||||||
|
public class SSSDException extends RuntimeException {
|
||||||
|
public SSSDException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SSSDException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SSSDException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,19 +94,19 @@ public class Sssd {
|
||||||
InfoPipe infoPipe = infopipe();
|
InfoPipe infoPipe = infopipe();
|
||||||
attributes = infoPipe.getUserAttributes(username, Arrays.asList(attr));
|
attributes = infoPipe.getUserAttributes(username, Arrays.asList(attr));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to retrieve user's attributes from SSSD", e);
|
throw new SSSDException("Failed to retrieve user's attributes. Check if SSSD service is active.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getUserGroups() {
|
public List<String> getUserGroups() {
|
||||||
List<String> userGroups = null;
|
List<String> userGroups;
|
||||||
try {
|
try {
|
||||||
InfoPipe infoPipe = Sssd.infopipe();
|
InfoPipe infoPipe = Sssd.infopipe();
|
||||||
userGroups = infoPipe.getUserGroups(username);
|
userGroups = infoPipe.getUserGroups(username);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to retrieve user's groups from SSSD", e);
|
throw new SSSDException("Failed to retrieve user's groups from SSSD. Check if SSSD service is active.");
|
||||||
}
|
}
|
||||||
return userGroups;
|
return userGroups;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue