use of com.sun.enterprise.security.auth.realm.BadRealmException in project Payara by payara.
the class GetGroupNamesCommand method execute.
@Override
public void execute(AdminCommandContext context) {
Config tmp = null;
try {
tmp = configs.getConfigByName(target);
} catch (Exception ex) {
}
if (tmp != null) {
config = tmp;
}
if (tmp == null) {
Server targetServer = domain.getServerNamed(target);
if (targetServer != null) {
config = domain.getConfigNamed(targetServer.getConfigRef());
}
com.sun.enterprise.config.serverbeans.Cluster cluster = domain.getClusterNamed(target);
if (cluster != null) {
config = domain.getConfigNamed(cluster.getConfigRef());
}
}
ActionReporter report = (ActionReporter) context.getActionReport();
try {
String[] list = getGroupNames(realmName, userName);
List<String> ret = Arrays.asList(list);
report.setActionExitCode(ExitCode.SUCCESS);
Properties props = new Properties();
props.put("groups", ret);
report.setExtraProperties(props);
report.setMessage("" + ret);
} catch (NoSuchRealmException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (BadRealmException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (InvalidOperationException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (NoSuchUserException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
}
}
use of com.sun.enterprise.security.auth.realm.BadRealmException in project Payara by payara.
the class SupportsUserManagementCommand method execute.
@Override
public void execute(AdminCommandContext context) {
Config tmp = null;
try {
tmp = configs.getConfigByName(target);
} catch (Exception ex) {
}
if (tmp != null) {
config = tmp;
}
if (tmp == null) {
Server targetServer = domain.getServerNamed(target);
if (targetServer != null) {
config = domain.getConfigNamed(targetServer.getConfigRef());
}
com.sun.enterprise.config.serverbeans.Cluster cluster = domain.getClusterNamed(target);
if (cluster != null) {
config = domain.getConfigNamed(cluster.getConfigRef());
}
}
ActionReport report = context.getActionReport();
report.setActionExitCode(ExitCode.SUCCESS);
try {
report.setMessage("" + supportsUserManagement(realmName));
} catch (BadRealmException ex) {
// throw new RuntimeException(ex);
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (NoSuchRealmException ex) {
// throw new RuntimeException(ex);
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (Exception ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
}
}
Aggregations