Skip to content
Snippets Groups Projects
Commit 1a7fc9a9 authored by Michael Simon's avatar Michael Simon
Browse files

Add Audit Details and start audit trail

parent 154cb177
No related branches found
No related tags found
No related merge requests found
......@@ -267,8 +267,11 @@ public class UserUpdater implements Serializable {
SamlIdpMetadataEntity idpEntity = idpDao.findByEntityId(user.getIdp().getEntityId());
IdpCommunicationAuditor auditor = new IdpCommunicationAuditor(auditDao, auditDetailDao, appConfig);
auditor.setName("UpdateUserFromIdp");
auditor.setDetail("Call IDP " + idpEntity.getEntityId() + " from SP " + spEntity.getEntityId() + " for User " + user.getEppn());
auditor.setIdp(idpEntity);
auditor.setSpConfig(spEntity);
auditor.startAuditTrail("");
EntityDescriptor idpEntityDescriptor = samlHelper.unmarshal(
idpEntity.getEntityDescriptor(), EntityDescriptor.class, auditor);
......@@ -286,6 +289,7 @@ public class UserUpdater implements Serializable {
*/
updateFail(user, e);
auditor.logAction(idpEntity.getEntityId(), "SAML ATTRIBUTE QUERY", user.getEppn(), e.getMessage(), AuditStatus.FAIL);
auditor.finishAuditTrail();
updateIdpStatus(SamlIdpMetadataEntityStatus.FAULTY, idpEntity);
throw new UserUpdateException(e);
} catch (MetadataException e) {
......@@ -295,11 +299,13 @@ public class UserUpdater implements Serializable {
*/
updateFail(user, e);
auditor.logAction(idpEntity.getEntityId(), "SAML ATTRIBUTE QUERY", user.getEppn(), e.getMessage(), AuditStatus.FAIL);
auditor.finishAuditTrail();
updateIdpStatus(SamlIdpMetadataEntityStatus.FAULTY, idpEntity);
throw new UserUpdateException(e);
} catch (SecurityException e) {
updateFail(user, e);
auditor.logAction(idpEntity.getEntityId(), "SAML ATTRIBUTE QUERY", user.getEppn(), e.getMessage(), AuditStatus.FAIL);
auditor.finishAuditTrail();
updateIdpStatus(SamlIdpMetadataEntityStatus.FAULTY, idpEntity);
throw new UserUpdateException(e);
}
......@@ -336,11 +342,13 @@ public class UserUpdater implements Serializable {
} catch (DecryptionException e) {
updateFail(user, e);
auditor.logAction(idpEntity.getEntityId(), "SAML ATTRIBUTE QUERY", user.getEppn(), e.getMessage(), AuditStatus.FAIL);
auditor.finishAuditTrail();
updateIdpStatus(SamlIdpMetadataEntityStatus.FAULTY, idpEntity);
throw new UserUpdateException(e);
} catch (IOException e) {
updateFail(user, e);
auditor.logAction(idpEntity.getEntityId(), "SAML ATTRIBUTE QUERY", user.getEppn(), e.getMessage(), AuditStatus.FAIL);
auditor.finishAuditTrail();
updateIdpStatus(SamlIdpMetadataEntityStatus.FAULTY, idpEntity);
throw new UserUpdateException(e);
} catch (SamlAuthenticationException e) {
......@@ -349,6 +357,7 @@ public class UserUpdater implements Serializable {
*/
updateFail(user, e);
auditor.logAction(idpEntity.getEntityId(), "SAML ATTRIBUTE QUERY", user.getEppn(), e.getMessage(), AuditStatus.FAIL);
auditor.finishAuditTrail();
updateIdpStatus(SamlIdpMetadataEntityStatus.FAULTY, idpEntity);
throw new UserUpdateException(e);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment