adn-agov-iam-project/patterns/5d7dc3d51416356293a239f7_re.../sts_audit_failure.groovy

18 lines
832 B
Groovy

try {
def user = inargs['UserID'] ?: session['ch.adnovum.nevisidm.user.extId'] ?: 'unknown'
def techuser = session['agov.techuser.extId'] ?: 'unknown'
def sourceIp = request.getTransportLayerInformation().getRemoteIP() ?: 'unknown'
def credentialType = request.getResource().replaceAll("\\/nevisauth\\/services\\/sts\\/(.+)\\/", "\$1").toUpperCase()
def lasterrorinfo = notes.getProperty('lasterrorinfo', '-')
def lasterror = notes.getProperty('lasterror', '-')
if (credentialType=='SAML') {
credentialType = 'PASSWORD'
}
LOG.warn("Event='TKNFAILED', Techuser=${techuser}, User=${user}, CredentialType='${credentialType}', SourceIp=${sourceIp}, lasterrorinfo='${lasterrorinfo}', lasterror=${lasterror}")
} catch (Exception e) {
LOG.warn("Exception in Script: ${e}")
} finally {
response.setResult('ok')
}