Import and Export Authentication Providers

You can save an authentication provider and its parameters as a JSON definition file to a download directory. You do this by exporting your authentication provider. You can import the authentication provider into your test or production environments.
lac42
You can save an authentication provider and its parameters as a JSON definition file to a download directory. You do this by exporting your authentication provider. You can import the authentication provider into your test or production environments.
In this article:
 
 
3
 
 
Export an Authentication Provider from your TeamSpace
 Exporting your authentication provider creates a copy of your authentication provider.
You can export authentication providers using the following methods:
  • Export using API Creator.
  • Export using scripts of API calls.
Export Using API Creator
Follow these steps:
 
  1. In API Creator, on the APIs page, click the 
    Auth Providers
     tab.
    The Authentication Providers page appears.
  2. Select the authentication provider that you want to export from the list of authentication providers.
  3. On the 
    APIs
     tab, click 
    Export
    .
Your authentication provider is downloaded as a JSON file. The syntax for the file name is 
AuthenticationProvider_<authentication provider name>.jso
n.
Export Using Scripts
You can script the export of an authentication provider using the 
Layer7 Live API Creator
 Admin command-line interface (Admin CLI), 
lacadmin
 (or the alias 
liveapicreatoradmin
). Use the 
export
 command.
For more information about the syntax for this command, see Admin CLI documentation.
The following code block shows an example of scripting the export of the authentication provider using the Admin CLI:
$lacadmin authprovider list $lacadmin authprovider export --authprovider [ident] --file authprovider_demo.json
Import an Authentication Provider into your TeamSpace
You can import a previously exported authentication provider into your TeamSpace. APIs in your TeamSpace can use this authentication provider for authentication. 
You can import authentication providers using the following methods:
  • Import using API Creator.
  • Import using scripts of API calls.
Import Using API Creator
Follow these steps:
 
  1. On the 
    Auth Providers
     tab, click 
    Import
    .
    The Import JSON window opens.
  2. Select the authentication provider JSON file that you exported, and then import the file.
    If the authentication provider name already exists, you cannot import the authentication provider. Rename the existing authentication provider to a different name.
The authentication provider is imported and displays in the list.
Import Using Scripts
You can script the import of the authentication providers that you exported from your local development environment or from your source code repository directory. You can script the import of your authentication provider using the 
Layer7 Live API Creator
 Admin CLI. Use the 
import
 command.
For more information about the syntax for this command, see GitHub.
The following code block shows an example scripting the import of the authentication provider using the Admin CLI:
$lacadmin authprovider import --file authprovider_demo.json
Next Steps
Now that you have imported the authentication provider into your TeamSpace, you can import the APIs that are authenticating API users using this authentication provider. API Server preserves the authentication provider during API import if it can identify the authentication provider by its name. If API Server cannot preserve the authentication provider, it defaults the authentication provider for the API to the 
built-in authentication
 authentication provider.
For more information about this step in the team development process, see Team Development.
Update Existing API to Use the Imported Authentication Provider Using Scripts 
You can update an existing API to use the imported authentication provider. 
The following code block shows an example of obtaining the ident of the authentication provider that you have imported by issuing the 
lacadmin authprovider list
 command. You need the ident to import the authentication provider into the API. The 
lacadmin api import
 command command updates the API to use the imported authentication provider:
$lacadmin authprovider list -- get the <ident> of the auth provider $lacadmin api use --url_name demo $lacadmin api import --authprovider <ident>