A policy violation refers to an identity violation based on access permissions. It gets evaluated during access requests, which we consider a preventive mechanism, as well as during identity refreshes, which are viewed as a detective mechanism. In general, you can determine whether a violation occurs based on access/roles, and you can also use account details through the ‘identity’ argument. However, you won’t get details directly from the identity request. Instead, use the ‘identity’ attribute, retrieve the actual identity through the context, and compare both to check for details related to password requests.