How to use the tokendito.settings.okta_profile function in tokendito

To help you get started, we’ve selected a few tokendito examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dowjones / tokendito / tokendito / helpers.py View on Github external
def process_ini_file(file, profile):
    """Process options from a ConfigParser ini file.

    :param file: filename
    :param profile: profile to read
    :return: None
    """
    config = configparser.ConfigParser(default_section=settings.okta_profile)
    if config.read(file) == []:
        return

    try:
        for (key, val) in config.items(profile):
            if hasattr(settings, key):
                logging.debug(
                    'Set option {}={} from ini file'.format(key, val))
                setattr(settings, key, val)
    except configparser.NoSectionError:
        logging.error('Profile \'{}\' does not exist.'.format(profile))
        sys.exit(2)
github dowjones / tokendito / tokendito / helpers.py View on Github external
help='Displays version and exit')
    parser.add_argument('--configure', '-c', action='store_true', help='Prompt user for '
                        'configuration parameters')
    parser.add_argument('--username', '-u', type=to_unicode, dest='okta_username',
                        help='username to login to Okta. You can '
                        'also use the OKTA_USERNAME environment variable.')
    parser.add_argument('--password', '-p', type=to_unicode, dest='okta_password',
                        help='password to login to Okta. You '
                        'can also user the OKTA_PASSWORD environment variable.')
    parser.add_argument('--config-file', '-C', type=to_unicode,
                        default=settings.config_file,
                        help='Use an alternative configuration file')
    parser.add_argument('--okta-aws-app-url', '-ou', type=to_unicode,
                        help='Okta App URL to use.')
    parser.add_argument('--okta-profile', '-op', type=to_unicode,
                        default=settings.okta_profile,
                        help='Okta configuration profile to use.')
    parser.add_argument('--aws-region', '-r', type=to_unicode,
                        help='Sets the AWS region for the profile')
    parser.add_argument('--aws-output', '-ao', type=to_unicode,
                        help='Sets the AWS output type for the profile')
    parser.add_argument('--aws-profile', '-ap', type=to_unicode,
                        help='Override AWS profile to save as in the credentials file.')
    parser.add_argument('--mfa-method', '-mm', type=to_unicode,
                        help='Sets the MFA method')
    parser.add_argument('--mfa-response', '-mr', type=to_unicode,
                        help='Sets the MFA response to a challenge')
    parser.add_argument('--role-arn', '-R', type=to_unicode,
                        help='Sets the IAM role')
    parser.add_argument('--output-file', '-o', type=to_unicode,
                        help="Log output to filename")
    parser.add_argument('--loglevel', '-l', type=lambda s: s.upper(), default='ERROR',