auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RelativeUri is the relative URI of the API Gateway auth service router
	RelativeUri = "/auth"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(
	apiRoute *gin.RouterGroup, service *Service,
	jwtValidator commonjwtvalidator.Validator,
	restMap *map[string]map[pbtypes.RESTMethod]pbtypes.
		GRPCMethod,
	grpcInterceptions *map[pbtypes.GRPCMethod]pbtypes.Interception,
	authLogger authmiddleware.Logger,
) (*Controller, error)

NewController creates a new controller

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the service for auth

func NewService

func NewService(flag *commonflag.ModeFlag, client pbauth.AuthClient) *Service

NewService creates a new service

func (*Service) AddPermission

func (s *Service) AddPermission(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.AddPermissionRequest,
) (
	*pbauth.AddPermissionResponse, error,
)

AddPermission adds a permission

func (*Service) AddRole

func (s *Service) AddRole(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.AddRoleRequest,
) (*pbauth.AddRoleResponse, error)

AddRole adds a role

func (*Service) AddRolePermission

func (s *Service) AddRolePermission(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.AddRolePermissionRequest,
) (
	*pbauth.AddRolePermissionResponse, error,
)

AddRolePermission adds a permission to a role

func (*Service) AddUserRole

func (s *Service) AddUserRole(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.AddUserRoleRequest,
) (
	*pbauth.AddUserRoleResponse, error,
)

AddUserRole adds a role to a user

func (*Service) CloseSession added in v0.1.0

func (s *Service) CloseSession(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.CloseSessionRequest,
) (
	*pbauth.CloseSessionResponse, error,
)

CloseSession closes the user' session

func (*Service) CloseSessions

func (s *Service) CloseSessions(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.CloseSessionsRequest,
) (
	*pbauth.CloseSessionsResponse, error,
)

CloseSessions closes all the user' sessions

func (*Service) GetPermission

func (s *Service) GetPermission(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.GetPermissionRequest,
) (
	*pbauth.GetPermissionResponse, error,
)

GetPermission gets all the permissions

func (*Service) GetPermissions

func (s *Service) GetPermissions(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.GetPermissionsRequest,
) (
	*pbauth.GetPermissionsResponse, error,
)

GetPermissions gets all the permissions

func (*Service) GetRolePermissions

func (s *Service) GetRolePermissions(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.GetRolePermissionsRequest,
) (
	*pbauth.GetRolePermissionsResponse, error,
)

GetRolePermissions gets all the role's permissions

func (*Service) GetRoles

func (s *Service) GetRoles(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.GetRolesRequest,
) (*pbauth.GetRolesResponse, error)

GetRoles gets all the roles

func (*Service) GetSessions

func (s *Service) GetSessions(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.GetSessionsRequest,
) (
	*pbauth.GetSessionsResponse, error,
)

GetSessions gets all the user' sessions

func (*Service) GetUserRoles

func (s *Service) GetUserRoles(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.GetUserRolesRequest,
) (
	*pbauth.GetUserRolesResponse, error,
)

GetUserRoles gets all the user's roles

func (*Service) IsAccessTokenValid added in v0.1.0

func (s *Service) IsAccessTokenValid(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.IsAccessTokenValidRequest,
) (
	*pbauth.IsAccessTokenValidResponse, error,
)

IsAccessTokenValid checks if the access token is valid

func (*Service) IsRefreshTokenValid added in v0.1.0

func (s *Service) IsRefreshTokenValid(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.IsRefreshTokenValidRequest,
) (
	*pbauth.IsRefreshTokenValidResponse, error,
)

IsRefreshTokenValid checks if the refresh token is valid

func (*Service) LogIn

func (s *Service) LogIn(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.LogInRequest,
) (*pbauth.LogInResponse, error)

LogIn logs in q user

func (*Service) LogOut

func (s *Service) LogOut(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.LogOutRequest,
) (*pbauth.LogOutResponse, error)

LogOut logs out the user

func (*Service) RefreshToken

func (s *Service) RefreshToken(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.RefreshTokenRequest,
) (
	*pbauth.RefreshTokenResponse, error,
)

RefreshToken refreshes the user's token

func (*Service) RevokePermission

func (s *Service) RevokePermission(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.RevokePermissionRequest,
) (
	*pbauth.RevokePermissionResponse, error,
)

RevokePermission revokes a permission

func (*Service) RevokeRole

func (s *Service) RevokeRole(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.RevokeRoleRequest,
) (
	*pbauth.RevokeRoleResponse, error,
)

RevokeRole revokes a role

func (*Service) RevokeRolePermission

func (s *Service) RevokeRolePermission(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.RevokeRolePermissionRequest,
) (
	*pbauth.RevokeRolePermissionResponse, error,
)

RevokeRolePermission revokes a permission from a role

func (*Service) RevokeUserRole

func (s *Service) RevokeUserRole(
	ctx *gin.Context,
	grpcCtx context.Context,
	request *pbauth.RevokeUserRoleRequest,
) (
	*pbauth.RevokeUserRoleResponse, error,
)

RevokeUserRole revokes a role from a user

Jump to

Keyboard shortcuts

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