@PutMapping(path = "/{username}", produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Update Duo Security user account from Duo Admin API", parameters = {
        @Parameter(name = "username", required = true, in = ParameterIn.PATH, description = "The username to update"),
        @Parameter(name = "providerId", description = "The multifactor authentication provider id defined in CAS settings")
    })
    public ResponseEntity updateUser(@PathVariable("username") final String username,
                                     @RequestParam(required = false) final String providerId,
                                     @io.swagger.v3.oas.annotations.parameters.RequestBody(
                                         description = "Duo user account as a JSON entity to update",
                                         required = true,
                                         content = @Content(schema = @Schema(implementation = DuoSecurityUserAccount.class)))
                                     @RequestBody final DuoSecurityUserAccount account) {
        val results = new LinkedHashMap<String, DuoSecurityUserAccount>();
        val providers = applicationContext.getBeansOfType(DuoSecurityMultifactorAuthenticationProvider.class).values();
        providers
            .stream()
            .filter(Objects::nonNull)
            .filter(BeanSupplier::isNotProxy)
            .filter(provider -> StringUtils.isBlank(providerId) || provider.matches(providerId))
            .filter(provider -> provider.getDuoAuthenticationService().getAdminApiService().isPresent())
            .forEach(Unchecked.consumer(provider -> {
                val duoService = provider.getDuoAuthenticationService().getAdminApiService().orElseThrow();
                duoService.modifyDuoSecurityUserAccount(account.withUsername(username))
                    .ifPresent(user -> results.put(provider.getId(), user));
            }));
        return results.isEmpty() ? ResponseEntity.notFound().build() : ResponseEntity.ok(results);
    }
Update user and return response entity.

@param username   the username
@param providerId the provider id
@param account    the account
@return the response entity
support/cas-server-support-duo-core/src/main/java/org/apereo/cas/adaptors/duo/web/DuoSecurityAdminApiEndpoint.java