public boolean preAuthorization(AdminCommandContext context) {
asc = chooseConfig();
final SecurityService ss = asc.getSecurityService();
adminAuthRealm = getAdminRealm(ss);
adminService = asc.getAdminService();
final AuthenticationService adminAuthService = (AuthenticationService)
securityConfigs.getSecurityServiceByName(AUTHENTICATION_SERVICE_PROVIDER_NAME);
final ActionReport report = context.getActionReport();
if (adminAuthService == null) {
report.setMessage(lsm.getString("ldap.noExistingAtnService", AUTHENTICATION_SERVICE_PROVIDER_NAME));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return false;
}
fileRealmProvider = adminAuthService.getSecurityProviderByName(FILE_REALM_SECURITY_PROVIDER_NAME);
if (fileRealmProvider == null) {
report.setMessage(lsm.getString("ldap.noExistingAtnProvider", FILE_REALM_SECURITY_PROVIDER_NAME));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return false;
}
if ( ! "LoginModule".equals(fileRealmProvider.getType())) {
report.setMessage(lsm.getString("ldap.fileRealmProviderNotLoginModuleType",
FILE_REALM_SECURITY_PROVIDER_NAME,
adminAuthService.getName(),
fileRealmProvider.getType()));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return false;
}
return true;