npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@okta/stormpath-migration

v0.14.0

Published

Migration tool to import Stormpath data into an Okta tenant

Downloads

15

Readme

stormpath-migration

Requirements

Prerequisites

To use this tool, you must have a Stormpath export unzipped on your local filesystem. The directory structure should be as follows:

├── home/
│   ├── {tenantId}/
│   │   ├── directories/
│   │   │   ├── {directoryId}.json
│   │   │   ├-- ....
│   │   ├── providers/
│   │   │   ├── {directoryId}.json
│   │   │   ├-- ....
│   │   ├── accounts/
│   │   │   ├── {directoryId}/
│   │   │   │   ├── {accountId}.json
│   │   │   │   ├-- ....
│   │   │   ├-- ....
│   │   ├── groups/
│   │   │   ├── {directoryId}/
│   │   │   │   ├── {groupId}.json
│   │   │   │   ├-- ....
│   │   │   ├-- ....
│   │   ├── organizations/
│   │   │   ├── {organizationId}.json
│   │   │   ├-- ....

Note: Providers must match 1:1 with Directories (same filenames).

Note: The 'accounts' and 'groups' folders should be segmented by {directoryId} so that it's possible to iterate over them by directory.

Here's a concrete example:

├── home/
│   ├── tenant123/
│   │   ├── directories/
│   │   │   ├── 5LInED46hB6nv9auaOrIYW.json
│   │   │   ├── 7ZBZLdnlxFsEtIs4BRpUHk.json
│   │   │   ├-- ....
│   │   ├── providers/
│   │   │   ├── 5LInED46hB6nv9auaOrIYW.json
│   │   │   ├── 7ZBZLdnlxFsEtIs4BRpUHk.json
│   │   │   ├-- ....
│   │   ├── accounts/
│   │   │   ├── 5LInED46hB6nv9auaOrIYW/
│   │   │   │   ├── 8LJuP3l2Lke9XWL4Vpie3o.json
│   │   │   │   ├-- ....
│   │   │   ├── 7ZBZLdnlxFsEtIs4BRpUHk/
│   │   │   │   ├── 4DfxGCAyrxNyiqjPQIHfHI.json
│   │   │   │   ├-- ....
│   │   ├── groups/
│   │   │   ├── 5LInED46hB6nv9auaOrIYW/
│   │   │   │   ├── 1iMYLWrjvnc833sPCBVbtU.json
│   │   │   │   ├-- ....
│   │   │   ├── 7ZBZLdnlxFsEtIs4BRpUHk/
│   │   │   │   ├── d72ghS4bBhaqzuUN6ur1g.json
│   │   │   │   ├-- ....
│   │   ├── organizations/
│   │   │   ├── 7O67Ni1CG5bo9E9NLA3kdg.json
│   │   │   ├-- ....

In this example, the "stormpathBaseDir" would be /home/tenant123.

To Install:

$ npm install -g @okta/stormpath-migration

To Run:

$ import-stormpath --stormPathBaseDir /path/to/export/data --oktaBaseUrl https://your-org.okta.com --oktaApiToken 5DSfsl4x@3Slt6

Note: output is logged to the console as well as to a json log file. The first and last line of output indicate where the JSON log file was written to.

Required Args

--stormPathBaseDir (-b)

Root directory where your Stormpath tenant export data lives

  • Example: --stormPathBaseDir ~/Desktop/stormpath-exports/683IDSZVtUQewtFoqVrIEe

--oktaBaseUrl (-u)

Base URL of your Okta tenant

  • Example: --oktaBaseUrl https://your-org.okta.com

--oktaApiToken (-t)

API token for your Okta tenant (SSWS token)

  • Example: --oktaApiToken 00gdoRRz2HUBdy06kTDwTOiPeVInGKpKfG-H4P_Lij

Optional Args

--customData (-d)

Strategy for importing Stormpath Account custom data. Defaults to flatten.

  • Options:

  • Example: --customData stringify

--concurrencyLimit (-c)

Max number of concurrent transactions. Defaults to 30.

  • Example: --concurrencyLimit 200

--maxFiles (-f)

Max number of files to parse per directory. You can use this to preview a large import. For example, if you set the argument --maxFiles 50, the import tool will only run for the first 50 accounts, groups, directories, and other Stormpath objects that are imported.

  • Example: --maxFiles 50

--checkpointDir

When the import script starts, it tries to map the Stormpath data model to the Okta model - for example, finding all unique custom schema attributes in the Account objects, or mapping linked Accounts to the same Okta user. For large exports, this can take a long time and sometime cause CPU or memory issues.

Incremental import state is saved to the --checkpointDir, which defaults to {cwd}/tmp. If the import script is stopped, it will load this incremental state on the next run.

Note, when running from a saved state, warnings and messages from previous runs will not be written to the console. Output from previous runs is stored in the logs directory.

  • Example: --checkpointDir /Users/me/tmp

--checkpointProgressLimit

The number of accounts to process before logging a progress message to the console. This value is only used during the initial phase of the import, when the import tool introspects the Stormpath export data.

If you are working with a large export, you may want to increase this limit to reduce the number of messages that are logged to the console. The default value is 10000.

  • Example: --checkpointProgressLimit 50000

--fileOpenLimit

Max number of files to read concurrently from the Stormpath export directory. For large exports, you may want to raise this limit to increase thoroughput in processing the Stormpath export files.

Note, raising this limit will increase the CPU and memory usage of the import tool. Defaults to 100.

  • Example: --fileOpenLimit 1000

--logLevel (-l)

Logging level. Defaults to info.

  • Options: error, warn, info, verbose, debug, silly
  • Example: --logLevel verbose

Node memory errors

If you're working with a large export and get a process out of memory error, you can increase the limit by setting the NODE_OPTIONS environment variable:

# --max-old-space-size is in Megabytes. In this example, the limit is 4Gb.
$ export NODE_OPTIONS=--max-old-space-size=4096

After starting the import, this memory limit is logged to the console:

[2017-07-23 18:50:29] INFO     Starting import...
[2017-07-23 18:50:29] INFO     Writing log output to {{log_location}}
[2017-07-23 18:50:29] INFO     Heap size limit: 4329Mb

Organization Reset

If you need to run the import script again, but wish to start with a blank slate, this tool also provides a reset script that will remove all data from your org. The reset script takes the same arguments as the import script.

WARNING: This will delete all data from the specified org:

reset-okta --stormPathBaseDir /path/to/export/data --oktaBaseUrl https://your-org.okta.com --oktaApiToken 5DSfsl4x@3Slt6