@ ReadOperation ( produces = MediaType . APPLICATION_JSON_VALUE ) public Map < ? , ? > fetchAccountStatus ( @ Selector final String username , @ Nullable final String providerId ) { val results = new LinkedHashMap <> ( ) ; val providers = applicationContext . getBeansOfType ( DuoMultifactorAuthenticationProvider . class ) . values ( ) ; providers . stream ( ) . filter ( Objects :: nonNull ) . map ( DuoMultifactorAuthenticationProvider . class :: cast ) . filter ( provider -> StringUtils . isBlank ( providerId ) || provider . matches ( providerId ) ) . forEach ( p -> { val duoService = p . getDuoAuthenticationService ( ) ; val accountStatus = duoService . getDuoUserAccount ( username ) ; results . put ( p . getId ( ) , CollectionUtils . wrap ( "duoApiHost" , duoService . getApiHost ( ) , "name" , p . getFriendlyName ( ) , "accountStatus" , accountStatus ) ) ; } ) ; return results ; }
Fetch account status map .