auth

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(
	client client.HTTPClient,
	module *module.Module,
	password string,
	silent bool,
) ([]*http.Cookie, error)

Authenticate performs authentication against the partners.1c-bitrix.ru service using the provided module and password.

Parameters:

  • module (*module.Module): The module object. If nil, the function returns errors.ErrNilModule.
  • password (string): The password used for authentication. If empty, the function returns errors.ErrEmptyPassword.
  • silent (bool): Skip spinner.

Returns:

  • []*http.Cookie: A slice of cookies obtained from the authentication response, typically used for session management.
  • Error: Any error encountered during parameter validation or the authentication process.

Description: First validates that both the module and password are provided and non-empty. It creates an HTTP client with an associated cookie jar and wraps it using a request.client. Using a spinner for progress feedback, it calls httpClient.Authenticate with the module’s account and password. If authentication succeeds, the function returns the configured client and cookies; otherwise, it returns the encountered error.

func InputPassword

func InputPassword(cmd *cobra.Command, module *module.Module) (string, error)

InputPassword manages the process of obtaining and validating the password needed for authentication. It first checks if the password was provided as a flag, then checks environment variables, and if neither are found, it prompts the user to enter a password interactively.

Parameters: - cmd (*cobra.Command): The Cobra command that invoked the function. - module (*internal.Module): The module for which the password is being provided (may use environment variable).

Returns: - string: The validated password. - error: An error if the password is invalid or the prompt fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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