Skip to main content

FortiGate Admin Login

Support level: Community

What is FortiGate

FortiGate is a firewall from FortiNet. It is a NGFW with layer7 inspection and able to become a part of a FortiNet security fabric. --

This guide explains how to setup a FortiGate to use authentik as SAML provider for Admin Login. It does not cover how to setup SSLVPN logins, that is a different configuration.


The following placeholders will be used:

  • is the FQDN of the FortiGate install.
  • is the FQDN of the authentik install.
  • fgt.mapping is the name of the SAML Property Mapping.
  • ak.cert = The authentik self-signed certificate you use for the service provider.

[!IMPORTANT] If you have changed the port of the admin login from 443 to anything else you have to append it behind So f.e.

Custom Property Mapping

Create a new SAML Property Mapping under the Customization settings.

  • fgt.mapping is the value for the Name.
  • username is the value for the SAML Attribute Name.
  • return is the value for the Expression.

Create an application and SAML provider in authentik, and note the slug, because this will be used later. Create a SAML provider with the following parameters:


  • ACS URL:
  • Issuer:
  • Service Provider Binding: Post
  • Audience:
  • Signing Certificate: ak.cert
  • Property mappings: fgt.mapping

You can of course adjust durations.


  • Name: Fortigate
  • Slug: fortigate
  • Launch URL:

FortiGate Configuration

Navigate to and Import the Certificate ak.cert to the FortiGate. Then navigate to and select Single Sign-On Settings to configure SAML.

  • Select Service Provider (SP) under Mode to enable SAML authentication.
  • Set the SP Address to the FortiGate FQDN (This gives you the URLs to configure in authentik)
  • Set the Default Login Page to either Normal or Single-Sign On. (Normal allows both local and SAML authentication vs only SAML SSO.)

FortiGate creates a new user by default if one does not exist, so you will need to set the Default Admin Profile to the permissions you want any new users to have. (I have created a no_permissions profile to assign by default.)

Under SP Details set the SP entity ID to https. Note it for later use (this is your Audience value of the authentik SP-provider).

[!IMPORTANT] On both IdP Login and Logout URL change the <SLUG> to your own from the authentik application you have created.

  • Set IdP Type to Custom
  • Set IdP entity ID to
  • Set IdP Login URL to<SLUG>/sso/binding/redirect/
  • Set IdP Logout URL to<SLUG>/slo/binding/redirect/
  • Set IdP Certificate to ak.cert


These are just suggestions of what could be the cause of an issue and how to enable debug on the FortiGate.

Enabling debug on the FortiGate You can use the following commands on the FortiGate to enable debugging:

  1. Debug saml daemon This will provide all possible output from the SAML daemon. diag debug application samld -1

  2. Enable debug timestamps (optional) diagnose debug console timestamp enable

  3. Enabling debug output Before you can see any output you need to enable the debug mode. diagnose debug enable

  4. If you used SSO Login only instead of Normal and you are not able to log in again, you can try one of the following methods:

Method 1: Open this URL ( in a browser and choose Login Locally.

Method 2: Open the CLI and set the login page back to normal.

config system saml
set default-login-page normal