Documentation
¶
Overview ¶
internal/auth/auth.go
internal/auth/credentials.go
internal/auth/users.go
Index ¶
- Variables
- func ChangeUserPassword(username, currentPassword, newPassword string, isSuperuser bool) error
- func CreateUser(req models.UserCreateRequest) error
- func DeleteUser(username string) error
- func GenerateJWT(username string, expiresIn time.Duration) (string, error)
- func GetAllUsers() ([]models.UserDetails, error)
- func GetUserDetails(username string) (models.UserDetails, error)
- func InitAuth()
- func IsUserInGroup(username string, targetGroupName string) (bool, error)
- func ResolveLoginDuration(requested string, defaultDuration time.Duration) (time.Duration, error)
- func UpdateUser(username string, req models.UserUpdateRequest, allowPrivilegeUpdate bool) error
- func ValidateCredentials(username, password string) (bool, error)
- type Claims
Constants ¶
This section is empty.
Variables ¶
var ErrPrivilegeUpdateForbidden = errors.New("privilege updates require superuser privileges")
Functions ¶
func ChangeUserPassword ¶ added in v0.1.4
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
DeleteUser deletes the specified user from the system
func GenerateJWT ¶
GenerateJWT creates a new JWT for a given username and expiration duration.
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 ¶
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 ResolveLoginDuration ¶ added in v0.3.0
ResolveLoginDuration validates an optional login duration string and returns the effective JWT lifetime for the newly issued token.
func UpdateUser ¶ added in v0.1.4
func UpdateUser(username string, req models.UserUpdateRequest, allowPrivilegeUpdate bool) error
UpdateUser updates the specified user's information.
func ValidateCredentials ¶
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 ¶
ValidateJWT checks the validity of a JWT string