auth

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

internal/auth/auth.go

internal/auth/credentials.go

internal/auth/users.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeUserPassword added in v0.1.4

func ChangeUserPassword(username, currentPassword, newPassword string, isSuperuser bool) error

ChangeUserPassword changes a user's password

func CreateUser added in v0.1.4

func CreateUser(req models.UserCreateRequest) error

CreateUser creates a new Linux user with the specified details

func DeleteUser added in v0.1.4

func DeleteUser(username string) error

DeleteUser deletes the specified user from the system

func GenerateJWT

func GenerateJWT(username string) (string, error)

GenerateJWT creates a new JWT for a given username

func GetAllUsers added in v0.1.4

func GetAllUsers() ([]models.UserDetails, error)

GetAllUsers returns a list of all system users that are relevant to the API Filters out system accounts or other internal users by their UID ranges

func GetUserDetails added in v0.1.4

func GetUserDetails(username string) (models.UserDetails, error)

GetUserDetails retrieves detailed information about a specific user

func InitAuth added in v0.1.5

func InitAuth()

InitAuth initializes the auth package with the current server start time

func IsUserInGroup

func IsUserInGroup(username string, targetGroupName string) (bool, error)

IsUserInGroup checks if a Linux user is a member of a specific group. Returns false, nil if the group doesn't exist or the user isn't in it. Returns false, error for actual system errors during lookup.

func UpdateUser added in v0.1.4

func UpdateUser(username string, req models.UserUpdateRequest) error

UpdateUser updates the specified user's information

func ValidateCredentials

func ValidateCredentials(username, password string) (bool, error)

ValidateCredentials checks if the Linux user exists, validates the password using PAM, and verifies membership in EITHER the requiredAdminGroup OR the configured APIUserGroup.

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	jwt.RegisteredClaims
}

func ValidateJWT

func ValidateJWT(tokenString string) (*Claims, error)

ValidateJWT checks the validity of a JWT string

Jump to

Keyboard shortcuts

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