diff --git a/PowerFGT/Public/monitor/user/fortitoken.ps1 b/PowerFGT/Public/monitor/user/fortitoken.ps1 new file mode 100644 index 000000000..69c96b666 --- /dev/null +++ b/PowerFGT/Public/monitor/user/fortitoken.ps1 @@ -0,0 +1,48 @@ +# +# Copyright 2024, Alexis La Goutte +# +# SPDX-License-Identifier: Apache-2.0 +# +function Get-FGTMonitorUserFortitoken { + + <# + .SYNOPSIS + Get User Fortitoken + + .DESCRIPTION + Get User FortiToken ( description, type, license, status... ) + + .EXAMPLE + Get-FGTMonitorUserFortitoken + + Get User Fortitoken information + + #> + + Param( + [Parameter(Mandatory = $false)] + [String[]]$vdom, + [Parameter(Mandatory = $false)] + [psobject]$connection = $DefaultFGTConnection + ) + + Begin { + } + + Process { + + $invokeParams = @{ } + if ( $PsBoundParameters.ContainsKey('vdom') ) { + $invokeParams.add( 'vdom', $vdom ) + } + + $uri = 'api/v2/monitor/user/fortitoken' + + $response = Invoke-FGTRestMethod -uri $uri -method "GET" -body $body -connection $connection @invokeParams + $response.results + + } + + End { + } +} diff --git a/README.md b/README.md index 4d662ae29..ca88b64fb 100644 --- a/README.md +++ b/README.md @@ -1310,6 +1310,7 @@ It is possible to `monitor` FortiGate * `Get-FGTMonitorSystemInterface` Retrieve statistics for all system interfaces * `Get-FGTMonitorSystemHAChecksum` List of checksums for members of HA cluster * `Get-FGTMonitorSystemHAPeer` Get configuration of peer(s) in HA cluster +* `Get-FGTMonitorUserFortitoken` Retrieve a map of FortiTokens and their status * `Get-FGTMonitorUtmApplicationCategories` Get list of (UTM) Application Categories * `Get-FGTMonitorVpnIPsec` Return active IPsec VPNs * `Get-FGTMonitorVpnSsl` Retrieve a list of all SSL-VPN sessions and sub-sessions and Return statistics about the SSL-VPN diff --git a/Tests/integration/Connection.Tests.ps1 b/Tests/integration/Connection.Tests.ps1 index f208070e8..398aec523 100644 --- a/Tests/integration/Connection.Tests.ps1 +++ b/Tests/integration/Connection.Tests.ps1 @@ -322,6 +322,9 @@ Describe "Connect to a FortiGate (using multi connection)" { It "Use Multi connection for call Get Monitor Network ARP (< 6.4.0)" -skip:($fgt_version -ge "6.4.0") { { Get-FGTMonitorNetworkARP -connection $fgt } | Should -Throw "Monitor Network ARP is not available before Forti OS 6.4" } + It "Use Multi connection for call Get Monitor User Fortitoken" { + { Get-FGTMonitorUserFortitoken -connection $fgt } | Should -Not -Throw + } It "Use Multi connection for call Get Monitor UTM Application Categories" { { Get-FGTMonitorUtmApplicationCategories -connection $fgt } | Should -Not -Throw }