iam

package
v0.0.0-...-1b9946f Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenExpired            = errors.New("access token is expired")
	ErrInsufficientPermissions = errors.New("insufficient permissions")
	ErrInvalidCredentials      = errors.New("invalid credentials")
	ErrUserNotFound            = errors.New("user not found")
	ErrUserAlreadyExists       = errors.New("user already exists")
	ErrGroupNotFound           = errors.New("group not found")
	//ErrGroupAlreadyExists      = errors.New("group already exists")
	NullPermissions = []string{} // const value signifying no particular permissions required
)

Functions

This section is empty.

Types

type Group

type Group struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type IAM

type IAM interface {
	Login(ctx context.Context, username string, password string) (string, error)
	Logout(ctx context.Context, token string) error
	Authorize(ctx context.Context, token string, permissions []string) (userID string, err error)
	SetPassword(username string, password string, temporary bool) error

	CreateUser(user *User, password string, temporary bool) (id string, err error)
	DeleteUser(username string) error
	GetUser(ctx context.Context, username string) (*User, error)
	GetUserByEmail(ctx context.Context, email string) (*User, error)
	ListUsers(context.Context) ([]*User, error)
	SearchUsers(ctx context.Context, prefix string) ([]*User, error)

	CreateGroup(name string) (*Group, error)
	DeleteGroup(groupID string) error
	DeleteGroupByName(name string) error
	AddUserToGroup(userID string, groupID string) error
	RemoveUserFromGroup(userID string, groupID string) error
	ListUserGroups(ctx context.Context, userID string) ([]*Group, error)
	ListGroupMembers(ctx context.Context, groupID string) ([]*User, error)
	IsUserInGroup(ctx context.Context, userID string, groupID string) (bool, error)
	ResolveGroup(ctx context.Context, groupName string) (groupID string, err error)
}

type Scope

type Scope string

type User

type User struct {
	ID        string `json:"id"`
	Username  string `json:"username"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Email     string `json:"email"`
	Enabled   bool   `json:"enabled"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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