Migrate from Inversoft Passport to FusionAuth

Overview

If you are currently an Inversoft Passport customer and looking to move to FusionAuth you have come to the right place. Here you’ll find important information on API changes, database upgrade procedures, etc. We have attempted to build an exhaustive list of changes you will need to be aware of, but please do plan to test your migration and ask for assistance from the FusionAuth team during your migration.

The following sections are provided for you to review prior to upgrading to FusionAuth.

Naming Changes

In addition to the obvious change of Passport to FusionAuth, as you read through the documentation and update your integration be aware of the following name changes.

Name changes

Old nameNew NameDescription
PassportFusionAuthPassport is now known as FusionAuth
passport.propertiesfusionauth.propertiesThe Passport configuration file is now named fusionauth.properties.
Passport BackendFusionAuth AppThe Passport Backend which refers to the webservice that services APIs and provides the UI is now referred as FusionAuth or FusionAuth App.
passport-backendfusionauth-appThe passport-backend which was the name of the package or bundle which contained the Passport Backend service will now be called fusionauth-app.
Passport SearchFusionAuth SearchThe Passport Search which refers to the webservice that provides search capability to FusionAuth is now referred to FusionAuth Search.
passport-search-enginefusionauth-searchThe passport-search-engine which was the name of the package or bundle which contained the Passport Search Engine service will now be called fusionauth-search.
X-Passport-TenantIdX-FusionAuth-TenantIdThe X-Passport-TenantId which was used if you had configured more than one tenant to scope an API request to a particular tenant should be changed to X-FusionAuth-TenantId.

License Changes

Because FusionAuth is no longer licensed in a traditional way, no license is required and no license checks are performed during a User create or Registration process. In Passport it was possible to receive a 402 status code indicating the license was expired or had exceeded the allocated usage, this response code will no longer be returned.

Breaking Changes

Review the following breaking changes when moving from Passport to FusionAuth. A breaking change means that compatibility has been broken and if your integration will break if you do not review the following changes and update your integration accordingly.

API Changes

  • When the Search Engine service is down or un-reachable a new status code of 503 will be returned. Previously this error condition would have returned a 500 status code.
  • If you were passing the Tenant Id in an HTTP header, this header X-Passport-TenantId should now be provided as X-FusionAuth-TenantId.
  • Application API
    • Free form data is now available on the Application object, see application.data
  • Audit Log API
    • auditLog.data.attributes moved to auditLog.data
    • auditLog.data.newValue moved to auditLog.newValue
    • auditLog.data.oldValue moved to auditLog.oldValue
    • auditLog.data.reason moved to auditLog.reason
  • Group API
    • group.data.attributes moved to group.data
  • Group Member API
    • groupMember.data.attributes moved to groupMember.data
  • SystemConfiguration API
    • systemConfiguration.failedAuthenticationUserActionId moved to systemConfiguration.failedAuthenticationConfiguration.userActionId
    • systemConfiguration.forgotEmailTemplateId moved to systemConfiguration.emailConfiguration.forgotPasswordEmailTemplateId
    • systemConfiguration.setPasswordEmailTemplateId moved to systemConfiguration.emailConfiguration.setPasswordEmailTemplateId
    • systemConfiguration.verificationEmailTemplateId moved to systemConfiguration.emailConfiguration.verificationEmailTemplateId
    • systemConfiguration.verifyEmail moved to systemConfiguration.emailConfiguration.verifyEmail
    • systemConfiguration.verifyEmailWhenChanged moved to systemConfiguration.emailConfiguration.verifyEmailWhenChanged
  • Tenant API
    • tenant.data.attributes moved to tenant.data
    • tenant.forgotEmailTemplateId moved to tenant.data
    • tenant.setPasswordEmailTemplateId moved to tenant.emailConfiguration.forgotPasswordEmailTemplateId
    • tenant.verificationEmailTemplateId moved to tenant.emailConfiguration.verificationEmailTemplateId
    • tenant.verifyEmail moved to tenant.emailConfiguration.verifyEmail
    • tenant.verifyEmailWhenChanged moved to tenant.emailConfiguration.verifyEmailWhenChanged
  • User API
    • user.data.attributes moved to user.data
    • user.data.preferredLanguages moved to user.preferredLanguages
    • Removed childIds and parentId
  • User Registration API
    • userRegistration.data.attributes moved to userRegistration.data
    • userRegistration.data.timezone moved to userRegistration.timezone
    • userRegistration.data.preferredLanguages moved to userRegistration.preferredLanguages

Email Templates

The Forgot Email and Setup Password templates no longer support the verificationId replacement parameter. The verificationId replacement parameter was provided for backwards compatibility with older versions of Passport and has been removed in FusionAuth.

Review your Forgot Password and Setup Password email templates and if you are using the replacement value ${verificationId} in either the HTML or Text version of the template, replace it with ${changePasswordId}.

See Email Templates for additional information.

Client Libraries

If you were using a Passport Client library please upgrade to the FusionAuth version. See Client Libraries

Removed Features

  • Parent and Child relationships between users was removed in FusionAuth. This feature is planned to be re-introduced with better support for a family structure and a more flexible relationship model. If you currently utilize this feature please contact the FusionAuth team for assistance.

Database Migration

Due to the data model changes that were made in FusionAuth your database schema will need to be updated. Please be aware that you Passport database MUST be upgraded to the latest version prior to migrating to FusionAuth. The latest Passport version is 1.22.4, the easiest way to upgrade your schema is to install the latest version of Passport and start up the service and allow Maintenance Mode to upgrade your database for you. Once this is complete you may then run the migration script.

Stop! Read me

Prior to upgrading to FusionAuth, you MUST upgrade Passport to version 1.22.4. If you do not, this will not work and you will need to restore your database from a backup.

MySQL

The following is the MySQL database migration. Please ensure you fully test this migration or contact the FusionAuth team for assistance.

-- Passport to FusionAuth

-- Update the version.
UPDATE version
SET version = '1.0.0';

CREATE TABLE instance (
  id         BINARY(16) NOT NULL,
  support_id BINARY(16) NULL
)
  ENGINE = innodb
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_bin;

-- Insert instance
INSERT INTO instance(id)
  VALUES (random_bytes(16));

-- Rename the forgot password
ALTER TABLE system_configuration
  CHANGE COLUMN forgot_email_templates_id forgot_password_email_templates_id BINARY(16) NULL;
ALTER TABLE tenants
  CHANGE COLUMN forgot_email_templates_id forgot_password_email_templates_id BINARY(16) NULL;

-- Delete the system_configuration columns (verify_email and verify_email_when_changed didn't make it through and need to be manually updated)
UPDATE system_configuration
SET data = JSON_INSERT(data, '$.data', CAST('{}' AS JSON));
UPDATE system_configuration
SET data = JSON_INSERT(data, '$.emailConfiguration', CAST(email_configuration AS JSON));
UPDATE system_configuration
SET data = JSON_INSERT(data, '$.emailConfiguration.verifyEmail', IF(verify_email = 1, TRUE, FALSE) IS TRUE);
UPDATE system_configuration
SET data = JSON_INSERT(data, '$.emailConfiguration.verifyEmailWhenChanged', IF(verify_email_when_changed = 1, TRUE, FALSE) IS TRUE);
UPDATE system_configuration
SET data = JSON_INSERT(data, '$.passwordValidationRules', CAST(password_validation_rules AS JSON));
ALTER TABLE system_configuration
  DROP COLUMN email_configuration,
  DROP COLUMN password_expiration_days,
  DROP COLUMN password_validation_rules,
  DROP COLUMN verify_email,
  DROP COLUMN verify_email_when_changed;

-- Add timezone to registration
ALTER TABLE user_registrations
  ADD COLUMN timezone VARCHAR(255) NULL;

-- Delete parent/child relationships
ALTER TABLE users
  DROP COLUMN parent_id,
  DROP COLUMN parental_consent_type;

-- Clean up application (two cases because some old Applications might have a data column with the value '{}' only)
UPDATE applications
SET data = JSON_INSERT(data, '$.data', CAST('{}' AS JSON));
UPDATE applications
SET data = JSON_INSERT(data, '$.cleanSpeakConfiguration', CAST(clean_speak_configuration AS JSON));
UPDATE applications
SET data = JSON_INSERT(data, '$.oauthConfiguration', CAST(oauth_configuration AS JSON));
ALTER TABLE applications
  DROP COLUMN clean_speak_configuration,
  DROP COLUMN oauth_configuration;

-- Fix the data column for audit_logs
UPDATE audit_logs
SET data = JSON_REMOVE(JSON_INSERT(data, '$.data', CAST(COALESCE(JSON_EXTRACT(data, '$.attributes'), '{}') AS JSON)), '$.attributes');

-- Fix the data column for groups
UPDATE groups
SET data = JSON_REMOVE(JSON_INSERT(data, '$.data', CAST(COALESCE(JSON_EXTRACT(data, '$.attributes'), '{}') AS JSON)), '$.attributes');

-- Fix the data column for group_members
UPDATE group_members
SET data = JSON_REMOVE(JSON_INSERT(data, '$.data', CAST(COALESCE(JSON_EXTRACT(data, '$.attributes'), '{}') AS JSON)), '$.attributes');

-- Fix the data column for users
UPDATE users
SET data = JSON_REMOVE(JSON_INSERT(data, '$.data', CAST(COALESCE(JSON_EXTRACT(data, '$.attributes'), '{}') AS JSON)), '$.attributes');

-- Fix the data column for user_registrations
UPDATE user_registrations
SET data = JSON_REMOVE(JSON_INSERT(data, '$.data', CAST(COALESCE(JSON_EXTRACT(data, '$.attributes'), '{}') AS JSON)), '$.attributes');

-- Fix the data column for tenants
UPDATE tenants
SET data = JSON_REMOVE(JSON_INSERT(data, '$.data', CAST(COALESCE(JSON_EXTRACT(data, '$.attributes'), '{}') AS JSON)), '$.attributes');
UPDATE tenants
SET data = JSON_INSERT(data, '$.emailConfiguration.verifyEmail', COALESCE(JSON_EXTRACT(data, '$.verifyEmail'), FALSE));
UPDATE tenants
SET data = JSON_INSERT(data, '$.emailConfiguration.verifyEmailWhenChanged', COALESCE(JSON_EXTRACT(data, '$.verifyEmailWhenChanged'), FALSE));

-- Fix the internal API key
DELETE
  FROM authentication_keys
  WHERE id LIKE '__internal_%' AND meta_data LIKE '%"cacheReloader"%';
INSERT INTO authentication_keys(id, permissions, meta_data, tenants_id)
  VALUES (concat('__internal_', replace(to_base64(random_bytes(64)), '\n', '')),
          '{"endpoints": {"/api/cache/reload": ["POST"]}}', '{"attributes": {"internalCacheReloader": "true"}}', NULL);

PostgreSQL

The following is the PostgreSQL database migration. Please ensure you fully test this migration or contact the FusionAuth team for assistance.

\set ON_ERROR_STOP true

-- Passport to FusionAuth

-- Update the version.
UPDATE version
SET version = '1.0.0';

CREATE TABLE instance (
  id         UUID NOT NULL,
  support_id UUID NULL
);

-- Insert instance
INSERT INTO instance(id)
  VALUES (md5(random() :: TEXT || clock_timestamp() :: TEXT) :: UUID);

-- Rename the forgot password
ALTER TABLE system_configuration
  RENAME COLUMN forgot_email_templates_id TO forgot_password_email_templates_id;
ALTER TABLE tenants
  RENAME COLUMN forgot_email_templates_id TO forgot_password_email_templates_id;

-- Delete the system_configuration columns
-- Delete the system_configuration columns (verify_email and verify_email_when_changed didn't make it through and need to be manually updated)
UPDATE system_configuration
SET data = JSONB_SET(data::JSONB, '{data}', '{}', TRUE);
UPDATE system_configuration
SET data = JSONB_SET(data::JSONB, '{emailConfiguration}', email_configuration::JSONB, TRUE);
UPDATE system_configuration
SET data = JSONB_SET(data::JSONB, '{emailConfiguration,verifyEmail}', TO_JSONB(verify_email), TRUE);
UPDATE system_configuration
SET data = JSONB_SET(data::JSONB, '{emailConfiguration,verifyEmailWhenChanged}', TO_JSONB(verify_email_when_changed), TRUE);
UPDATE system_configuration
SET data = JSONB_SET(data::JSONB, '{passwordValidationRules}', password_validation_rules::JSONB, TRUE);
ALTER TABLE system_configuration
  DROP COLUMN email_configuration,
  DROP COLUMN password_expiration_days,
  DROP COLUMN password_validation_rules,
  DROP COLUMN verify_email,
  DROP COLUMN verify_email_when_changed;

-- Add timezone to registration
ALTER TABLE user_registrations
  ADD COLUMN timezone VARCHAR(255) NULL;

-- Delete parent/child relationships
ALTER TABLE users
  DROP COLUMN parent_id,
  DROP COLUMN parental_consent_type;

-- Clean up application (two cases because some old Applications might have a data column with the value '{}' only)
UPDATE applications
SET data = JSONB_SET(data::JSONB, '{data}', '{}', TRUE);
UPDATE applications
SET data = JSONB_SET(data::JSONB, '{cleanSpeakConfiguration}', COALESCE(clean_speak_configuration, '{}')::JSONB, TRUE);
UPDATE applications
SET data = JSONB_SET(data::JSONB, '{oauthConfiguration}', COALESCE(oauth_configuration, '{}')::JSONB, TRUE);
ALTER TABLE applications
  DROP COLUMN clean_speak_configuration,
  DROP COLUMN oauth_configuration;

-- Fix the data column for audit_logs
UPDATE audit_logs
SET data = JSONB_SET(data::JSONB, '{data}', COALESCE(data::JSONB -> 'attributes', '{}')::JSONB, TRUE) - 'attributes';

-- Fix the data column for groups
UPDATE groups
SET data = JSONB_SET(data::JSONB, '{data}', COALESCE(data::JSONB -> 'attributes', '{}')::JSONB, TRUE) - 'attributes';

-- Fix the data column for group_members
UPDATE group_members
SET data = JSONB_SET(data::JSONB, '{data}', COALESCE(data::JSONB -> 'attributes', '{}')::JSONB, TRUE) - 'attributes';

-- Fix the data column for users
UPDATE users
SET data = JSONB_SET(data::JSONB, '{data}', COALESCE(data::JSONB -> 'attributes', '{}')::JSONB, TRUE) - 'attributes';

-- Fix the data column for user_registrations
UPDATE user_registrations
SET data = JSONB_SET(data::JSONB, '{data}', COALESCE(data::JSONB -> 'attributes', '{}')::JSONB, TRUE) - 'attributes';

-- Fix the data column for tenants
UPDATE tenants
SET data = JSONB_SET(data::JSONB, '{data}', COALESCE(data::JSONB -> 'data' -> 'attributes', '{}')::JSONB, TRUE) #- '{data,attributes}';
UPDATE tenants
SET data = JSONB_SET(data::JSONB, '{emailConfiguration,verifyEmail}', COALESCE(data::JSONB -> 'verifyEmail', TO_JSONB(FALSE)), TRUE);
UPDATE tenants
SET data = JSONB_SET(data::JSONB, '{emailConfiguration,verifyEmailWhenChanged}', COALESCE(data::JSONB -> 'verifyEmailWhenChanged', TO_JSONB(FALSE)), TRUE);

-- Fix the internal API key
DELETE
  FROM authentication_keys
  WHERE id LIKE '__internal_%' AND meta_data LIKE '%"cacheReloader"%';
INSERT INTO authentication_keys(id, permissions, meta_data, tenants_id)
  VALUES ('__internal_' || replace(
      encode(md5(random()::TEXT || clock_timestamp()::TEXT)::BYTEA || md5(random()::TEXT || clock_timestamp()::TEXT)::BYTEA, 'base64'),
      E'\n', ''), '{"endpoints": {"/api/cache/reload": ["POST"]}}', '{"attributes": {"internalCacheReloader": "true"}}', NULL);

Migration Summary

The following is a summary of the steps required to migration to FusionAuth and is provided as a guidelines to assist you in performing the migration steps in the correct order.

  1. Review all documented changes in this guide
  2. Make a backup of your database
  3. Upgrade Passport to the latest version.
  4. Install the latest version of FusionAuth
  5. Review and migrate settings from passport.properties to fusionauth.properties. You may have other settings that require migration in addition to the following.
  • database.url
  • database.username
  • database.password
  • passport-search-engine.memory is now fusionauth-search.memory
  • passport-backend.memory is now fusionauth-app.memory
  1. Run the SQL migration found above
  2. Start FusionAuth and bring up the UI and complete maintenance mode, you will be prompted to do the following steps:
  • Upgrade the db schema
  • Create search index
  1. Once logged into FusionAuth rebuild the Elasticsearch index
  • Navigate to System -> Reindex.
  1. Review your configuration in FusionAuth for accuracy.