app

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package app stores constants and global functions and objects related to the application.

Index

Constants

View Source
const (
	Title        = "Okta OpenVPN Auth Plugin"
	Copyright    = "Copyright (c) 2021 Josh Hogle.  All rights reserved."
	EnvVarPrefix = "OKTA_OPENVPN_AUTH_PLUGIN_"
)

General app settings.

View Source
const (
	DefaultConfigFile  = "config"
	DefaultGeoIPLocale = "en"
	DefaultLogLevel    = "info"
	DefaultMFATimeout  = "30s"

	MinMFATimeout = 15
)

Default configuration settings.

View Source
const (
	MFANone = 0
	MFATOTP = 1
	MFAPush = 2
)

Supported MFA methods

View Source
const (
	ConfigDir = "/opt/okta-openvpn-auth-plugin/etc"
)

Default configuration settings.

Variables

View Source
var (
	// Build is the first 8 characters of the git commit hash.
	Build string

	// Config holds the application configuration settings.
	Config *config

	// DevBuild is a flag to indicate if this is a developer build.
	DevBuild bool

	// DevBuildStr is the string version of DevBuild which is passed in at compile-time.
	DevBuildStr string

	// SemanticVersion is the actual semantic version of the product.
	SemanticVersion *semver.Version

	// Version is the current semver-compatible version of the product.
	Version string
)

Functions

This section is empty.

Types

type AuthOptions

type AuthOptions struct {
	// APIKeyFile holds the path to the Okta API key.
	APIKeyFile string `mapstructure:"api_key_file"`

	// APIKey holds the actual API key read from the API key file.
	APIKey string

	// GeoIPDBPath holds the path to the GeoIP data files.
	GeoIPDBPath string `mapstructure:"geoip_db_path"`

	// GeoIPLocale holds the locale to use for retrieving GeoIP data.
	GeoIPLocale string `mapstructure:"geoip_locale"`

	// Interactive determines whether or not to perform an interactive authentication.
	Interactive bool `mapstructure:"interactive"`

	// MFAMethods holds a bitmask for the allowed methods for MFA.
	MFAMethods uint8

	// MFATimeout holds the length of time to wait for a user to respond to an MFA request before timing out.
	MFATimeout time.Duration

	// OrgName holds the name of the Okta organization.
	OrgName string `mapstructure:"org_name"`

	// RawMFAMethods holds the list of unvalidated MFA methods.
	RawMFAMethods []string `mapstructure:"mfa_methods"`

	// RawMFATimeout holds the unparsed duration of how long to wait for a user to respond to an MFA request
	// before timing out.
	RawMFATimeout string `mapstructure:"mfa_timeout"`
}

AuthOptions holds the options for the auth command.

func (*AuthOptions) Validate

func (o *AuthOptions) Validate() error

Validate checks and saves any configuration settings from viper and ensures that all values are sane.

The following errors are returned by this function: ConfigValidateFailure

type GlobalOptions

type GlobalOptions struct {
	// ConfigDir is the directory in which the configuration file is located.
	ConfigDir string

	// EnableJSONLogging is flag which determines whether or not to log output as JSON instead of text.
	EnableJSONLogging bool `mapstructure:"enable_json_logging"`

	// LogLevel holds the the minimum level of events to log.
	LogLevel zerolog.Level

	// RawLogLevel holds the the minimum level of events to log as a string.
	RawLogLevel string `mapstructure:"log_level"`
}

GlobalOptions holds the global configuration settings.

func (*GlobalOptions) Validate

func (o *GlobalOptions) Validate() error

Validate checks and saves any configuration settings from viper and ensures that all values are sane.

The following errors are returned by this function: ConfigValidateFailure

type VersionOptions

type VersionOptions struct {
	// Short represents a flag used to determine whether to show just the version or not.
	Short bool `mapstructure:"short"`
}

VersionOptions holds specific settings for the version command.

func (*VersionOptions) Validate

func (o *VersionOptions) Validate() error

Validate checks and saves any configuration settings from viper and ensures that all values are sane.

The following errors are returned by this function: ConfigValidateFailure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL