Skip to content

Commit

Permalink
Fortitoken(monitor): Add Get-FGTUserFortiToken for get user FortiToken
Browse files Browse the repository at this point in the history
Fix #254
  • Loading branch information
alagoutte committed Dec 27, 2024
1 parent 2c25ba8 commit f74df0c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
48 changes: 48 additions & 0 deletions PowerFGT/Public/monitor/user/fortitoken.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Copyright 2024, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
#
# 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 {
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Tests/integration/Connection.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f74df0c

Please sign in to comment.