Giter Club home page Giter Club logo

oam's Introduction

Okta Administration Manager (OAM)

Summary

The Okta Administration Manager (OAM) allows sys admins to perform REST API calls to Okta from the command line. It also has the ability to perform bulk operations by pulling information from a CSV.

Current List of Supported Okta APIs

  • Users API
  • Groups API

Configuration Steps

  1. Download oam.py, config.json, and requirements.txt
  2. Install required packages listed in requirements.txt pip install -r requirements.txt
  3. Login to Okta as an Administrator with permissions to generate API keys. See full instructions here: Create an API Token
  4. Copy your token and paste it in the config.json file for "apiToken".
  5. Set the "orgURL", in config.json, to the URL for your okta domain (Example: "https://acme.okta.com").
  6. Save/close config.json
  7. Test your setup. Easiest way is to search for a user using the 'find' command. python oam.py user [email protected] find If you get the user's profile, as a json response, in the command window, then you're ready to rock-n-roll!

Commands

Syntax may be viewed using the help flag python oam.py -h The main command has two, optional arguments: --site [site_name] Used to define which Okta instance to call. See Multi-Site configuration setup, below. --csv [filename] When the csv argument is used the program will pull in data from the indicated csv file based on the values prefaced with a ~ in your command.

Example Command: python oam.py --csv test.csv user ~email update --profile primaryPhone ~phone mobilePhone ~cellphone This command would loop through the test.csv file for each record in the file, and replace the ~email, ~phone, and ~cellphone variables with the values from the columns containing the same name.

Example CSV file:

userID,email,phone,cellphone
1,"[email protected]","111-111-1111","222-222-2222"
2,"[email protected]","333-333-3333","444-444-4444"

User API

The user command will perform actions against a single user. The user command has two required, positional arguments:

  • Username: Okta username of the target user
  • Action: The command action you wish to perform. The following actions are currently supported:
    • find - Returns the full user profile for Username as json in command window
    • appLinks - Get Assigned App Links
    • groups - Get Member Groups
    • delete - Delete User
    • clear_user_sessions - Clear User Sessions
    • forgot_password - Forgot Password --sendEmail flag will return true and send the user a email notification
    • reset_password - Reset Password --sendEmail flag will return true and send the user a email notification
    • setTempPassword - Set Temporary Password Sends user temporary password via email
    • deactivate - Deactivate User
    • unlock - Unlock User
    • expire_password - Expire Password Expires password and does NOT send the user a temporary password in email
    • suspend - Suspend User
    • reset_factors - Reset Factors
    • unsuspend - Unsuspend User
    • setPassword - Set User Password --password flag is used to provide password value
    • setQuestion - Set Recovery Question & Answer --question and --answer flags are used to provide the desired question and answer values
    • update - Update Profile --profile flag allows for sending attribute: value pairs. The attribute, as it is shown in okta, should be listed first, and the value you wish to send second. Example: user foo.bar update --profile email [email protected] city Lawrence state KS
    • create - Create User --firstName & --lastName are required and the Username value is used for the login attribute value. Optional arguments for the create action are:
      • --email - Specify email address for the user. If not specified email is set to same as login value.
      • --activate - Activate the user after creation
      • --password - Specify a password for the new user
      • --question - Specify a security question for the new user
      • --answer - Specify a security answer for the new user
Groups API

The group command will perform actions against a single group. The group command has two required, positional arguments:

  • Group Name: Okta group name of the target group
  • Action: The command action you wish to perform. The following actions are currently supported:
    • create - Add Group --description is optional and provides the description value for the group group NewGroup create --description "This is my new group"
    • update - Update Group --description is optional and provides the description value for the group
    • listUsers - List Group Members Returns list of users in the specified group as json in command window (limit of 10,000 users)
    • addUser - Add User to Group --user is required and provides the login of the user you wish to add to the group group MyGroup addUser --user [email protected]
    • removeUser - Remove User from Group --user is required and provides the login of the user you wish to remove from the group
    • delete - Remove Group Prompts for confirmation.

Multi-site config.json Setup

The config.json file can store multiple Okta sites and API tokens. Such as your key for okta and oktapreview sites. To setup multi-site:

  1. Set the MULTI_SITE variable in oam.py equal to 1.
  2. Update the config.json as follows: {"prod":{"apiToken":"0987654321", "orgURL":"https://acme.okta.com"},"preview":{"apiToken":"1234567890", "orgURL":"https://acme.oktapreview.com"}} the site names you specify (prod and preview in the above example) are then what you will need to provide the --site argument each time you perform a command. Example: python oam.py --site prod user foo.bar find

oam's People

Contributors

dependabot[bot] avatar richard-wilhite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

oam's Issues

Some Commands return empty json response

The following commands return an empty json response () after successful completion. These should be updated to return a response code. Such as <[Response 204]> or whatever Okta is sending back.

The commands I'm seeing this on, are:

  • suspend
  • unsuspend
  • reset_factors
  • forgot_password
  • reset_password

Set Security Question Not Working

When attempting to set a security question an error is returned.
python oam.py --site preview user [email protected] setQuestion --question "test question" --answer "test answer"

{ "errorCode":"E0000003", "errorSummary":"The request body was not well-formed.", "errorLink":"E0000003", "errorCauses":[], "errorId":"<>" }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.