Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage authentication with API token #154

Merged
merged 10 commits into from
Feb 15, 2022
Merged

Conversation

kev-in-shu
Copy link
Contributor

@kev-in-shu kev-in-shu commented Nov 24, 2021

Add support for authenticating with API tokens

As requested in #100

API Account can be setup with the following FortiOS CLI commands

config system accprofile
    edit "api_powerfgt"
        set netgrp read-write
        set fwgrp read-write
        set vpngrp read-write
        set system-diagnostics disable
    next
end

config system api-user
    edit "myaccount_powerfgt"
        set accprofile "api_powerfgt"
        config trusthost
            edit 1
                set ipv4-trusthost 192.0.0.0 255.255.255.0
            next
        end
    next
end

Copy link
Contributor

@alagoutte alagoutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonjour Kevin,

Thanks for your contribution !!!
can you look to may be add a token test on testsuite ? (i can help you if you need)
we can considered we have already the ApiToken (need to set on credential.ps1), we don't have cmdlet yet for generate token (i see there is some new API call for this)

can you add also example on README.md about APItoken ?

PowerFGT/Public/Connection.ps1 Show resolved Hide resolved
PowerFGT/Public/Connection.ps1 Outdated Show resolved Hide resolved
@kev-in-shu
Copy link
Contributor Author

Bonjour Kevin,

Thanks for your contribution !!! can you look to may be add a token test on testsuite ? (i can help you if you need) we can considered we have already the ApiToken (need to set on credential.ps1), we don't have cmdlet yet for generate token (i see there is some new API call for this)

can you add also example on README.md about APItoken ?

Hi Alexis,

I added a test and a couple of notes in README.md

Regards,

Kevin

@alagoutte
Copy link
Contributor

Look good, need to have https for use token ? (About test), may be also skip token test if you don’t have set the token

@alagoutte
Copy link
Contributor

Thanks Kevin, ApiToken with FortiOS 7.0.(3) and HTTP, i need to check it is working also with PS5 (Tested with PS7 on Windows and macOS)

@alagoutte alagoutte merged commit 5368cb2 into FortiPower:master Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants