Hi,
For your information, I've made progress on the topic of MFA Triggers using a Groovy script as follows :
For your information, I've made progress on the topic of MFA Triggers using a Groovy script.
```
import java.util.*
def run(final Object... args) {
def (authentication,registeredService,httpRequest,service,applicationContext,logger) = args
logger.debug("Determine mfa provider for ${registeredService.name} and ${
authentication.principal.id}")
def groups = authentication.principal.attributes['GROUP'] as List
logger.info('Groupes trouves : {}', groups)
if (groups != null) {
if (groups.toString().contains('mfa-radius')) {
logger.info('=> Selection stricte de : mfa-radius')
return 'mfa-radius'
}
if (groups.toString().contains('mfa-simple')) {
logger.info('=> Selection stricte de : mfa-simple')
return 'mfa-simple'
}
}
logger.warn('=> Aucun groupe MFA trouve.')
return null
}
```
`GROUP` being the released LDAP attribute and in json file, I use
```
"multifactorPolicy": {
"@class": "org.apereo.cas.services.DefaultRegisteredServiceMultifactorPolicy",
"script": "file:///etc/cas/config/mfa-adaptatif.groovy"
}
```
Now, a little customization of the MFA Radius page and everything will be perfect ;)
Regards