use of org.jboss.security.audit.AuditManager in project wildfly by wildfly.
the class SimpleSecurityManager method authenticate.
private boolean authenticate(SecurityContext context, Subject subject) {
SecurityContextUtil util = context.getUtil();
SubjectInfo subjectInfo = getSubjectInfo(context);
if (subject == null) {
subject = new Subject();
}
Principal principal = util.getUserPrincipal();
Principal auditPrincipal = principal;
Object credential = util.getCredential();
Identity unauthenticatedIdentity = null;
boolean authenticated = false;
if (principal == null) {
unauthenticatedIdentity = getUnauthenticatedIdentity();
subjectInfo.addIdentity(unauthenticatedIdentity);
auditPrincipal = unauthenticatedIdentity.asPrincipal();
subject.getPrincipals().add(auditPrincipal);
authenticated = true;
} else {
subject.getPrincipals().add(principal);
}
if (authenticated == false) {
AuthenticationManager authenticationManager = context.getAuthenticationManager();
authenticated = authenticationManager.isValid(principal, credential, subject);
}
if (authenticated == true) {
subjectInfo.setAuthenticatedSubject(subject);
}
AuditManager auditManager = context.getAuditManager();
if (auditManager != null) {
audit(authenticated ? AuditLevel.SUCCESS : AuditLevel.FAILURE, auditManager, auditPrincipal);
}
return authenticated;
}
use of org.jboss.security.audit.AuditManager in project wildfly by wildfly.
the class UndertowDeploymentInfoService method handleIdentityManager.
private void handleIdentityManager(final DeploymentInfo deploymentInfo) {
if (securityDomain != null) {
SecurityDomainContext sdc = securityDomainContextValue.getValue();
deploymentInfo.setIdentityManager(new JAASIdentityManagerImpl(sdc));
AuditManager auditManager = sdc.getAuditManager();
if (auditManager != null && !mergedMetaData.isDisableAudit()) {
deploymentInfo.addNotificationReceiver(new AuditNotificationReceiver(auditManager));
}
}
}
use of org.jboss.security.audit.AuditManager in project wildfly by wildfly.
the class JNDIBasedSecurityManagement method getAuditManager.
/** {@inheritDoc} */
public AuditManager getAuditManager(String securityDomain) {
AuditManager am = null;
try {
am = auditMgrMap.get(securityDomain);
if (am == null) {
am = (AuditManager) lookUpJNDI(securityDomain + "/auditMgr");
auditMgrMap.put(securityDomain, am);
}
} catch (Exception e) {
SecurityLogger.ROOT_LOGGER.tracef(e, "Exception getting AuditManager for domain=%s", securityDomain);
}
return am;
}
Aggregations