grpc

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "ldap-manager"

ServiceName is the name of the service used for health checking

Variables

This section is empty.

Functions

func MethodRequiresAdmin added in v0.0.27

func MethodRequiresAdmin(ctx context.Context) (bool, error)

MethodRequiresAdmin checks if the GRPC method requires authentication

Types

type AuthClaims

type AuthClaims struct {
	Username    string `json:"username"`
	UID         int32  `json:"uid"`
	IsAdmin     bool   `json:"is_admin"`
	DisplayName string `json:"display_name"`
	jwt.RegisteredClaims
}

AuthClaims encode authentication JWT claims

func (*AuthClaims) GetRegisteredClaims added in v0.0.27

func (claims *AuthClaims) GetRegisteredClaims() *jwt.RegisteredClaims

GetRegisteredClaims returns the common registered claims

type LDAPManagerService added in v0.0.27

type LDAPManagerService struct {
	pb.UnimplementedLDAPManagerServer
	// contains filtered or unexported fields
}

LDAPManagerService implements the GRPC service

func NewLDAPManagerService added in v0.0.27

func NewLDAPManagerService(ctx context.Context, manager ldapmanager.LDAPManager, authenticator auth.Authenticator) LDAPManagerService

NewLDAPManagerService builds the service

func (*LDAPManagerService) AddGroupMember added in v0.0.27

func (s *LDAPManagerService) AddGroupMember(ctx context.Context, req *pb.GroupMember) (*pb.Empty, error)

AddGroupMember adds a new member to a group

func (*LDAPManagerService) Authenticate added in v0.0.27

func (s *LDAPManagerService) Authenticate(ctx context.Context) (*AuthClaims, error)

Authenticate attempts to authenticate a user. It checks if a token is supplied in the request context

func (*LDAPManagerService) ChangePassword added in v0.0.27

func (s *LDAPManagerService) ChangePassword(ctx context.Context, req *pb.ChangePasswordRequest) (*pb.Empty, error)

ChangePassword changes the password for an account

func (*LDAPManagerService) DeleteGroup added in v0.0.27

func (s *LDAPManagerService) DeleteGroup(ctx context.Context, req *pb.DeleteGroupRequest) (*pb.Empty, error)

DeleteGroup deletes a group

func (*LDAPManagerService) DeleteUser added in v0.0.27

func (s *LDAPManagerService) DeleteUser(ctx context.Context, req *pb.DeleteUserRequest) (*pb.Empty, error)

DeleteUser deletes an account

func (*LDAPManagerService) GetGroup added in v0.0.27

func (s *LDAPManagerService) GetGroup(ctx context.Context, req *pb.GetGroupRequest) (*pb.Group, error)

GetGroup gets a group

func (*LDAPManagerService) GetGroupList added in v0.0.27

func (s *LDAPManagerService) GetGroupList(ctx context.Context, req *pb.GetGroupListRequest) (*pb.GroupList, error)

GetGroupList returns a list of groups

func (*LDAPManagerService) GetUser added in v0.0.27

func (s *LDAPManagerService) GetUser(ctx context.Context, req *pb.GetUserRequest) (*pb.User, error)

GetUser gets a user

func (*LDAPManagerService) GetUserGroups added in v0.0.27

func (s *LDAPManagerService) GetUserGroups(ctx context.Context, req *pb.GetUserGroupsRequest) (*pb.GroupList, error)

GetUserGroups gets the groups an account is member of

func (*LDAPManagerService) GetUserList added in v0.0.27

func (s *LDAPManagerService) GetUserList(ctx context.Context, req *pb.GetUserListRequest) (*pb.UserList, error)

GetUserList gets a list of users

func (*LDAPManagerService) IsGroupMember added in v0.0.27

IsGroupMember checks if an account is member of a group

func (*LDAPManagerService) Login added in v0.0.27

func (s *LDAPManagerService) Login(ctx context.Context, req *pb.LoginRequest) (*pb.Token, error)

Login logs in a user

func (*LDAPManagerService) NewGroup added in v0.0.27

func (s *LDAPManagerService) NewGroup(ctx context.Context, req *pb.NewGroupRequest) (*pb.Empty, error)

NewGroup adds a new LDAP group

func (*LDAPManagerService) NewUser added in v0.0.27

func (s *LDAPManagerService) NewUser(ctx context.Context, req *pb.NewUserRequest) (*pb.Empty, error)

NewUser creates a new user

func (*LDAPManagerService) RemoveGroupMember added in v0.0.27

func (s *LDAPManagerService) RemoveGroupMember(ctx context.Context, req *pb.GroupMember) (*pb.Empty, error)

RemoveGroupMember removes a member of a group

func (*LDAPManagerService) Serve added in v0.0.27

func (s *LDAPManagerService) Serve(listener net.Listener) error

Serve serves the service on a listener

func (*LDAPManagerService) SetHealthy added in v0.0.29

func (s *LDAPManagerService) SetHealthy(healthy bool)

SetHealthy sets the health state for the service

func (*LDAPManagerService) Shutdown added in v0.0.27

func (s *LDAPManagerService) Shutdown()

Shutdown gracefully stops the service

func (*LDAPManagerService) SignUserToken added in v0.0.27

func (s *LDAPManagerService) SignUserToken(claims *AuthClaims) (*pb.Token, error)

SignUserToken signs an authentication claim and returns it as a JWT token

func (*LDAPManagerService) UpdateGroup added in v0.0.27

func (s *LDAPManagerService) UpdateGroup(ctx context.Context, req *pb.UpdateGroupRequest) (*pb.Empty, error)

UpdateGroup updates an LDAP group

func (*LDAPManagerService) UpdateUser added in v0.0.27

func (s *LDAPManagerService) UpdateUser(ctx context.Context, req *pb.UpdateUserRequest) (*pb.Token, error)

UpdateUser updates a user

Jump to

Keyboard shortcuts

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