Documentation ¶
Index ¶
- Constants
- Variables
- func Authorizer(e *casbin.Enforcer, sessionManager *session.SessionManager) func(next http.Handler) http.Handler
- func WhitelistChecker(url string) bool
- type CheckResponse
- type DexConfig
- type RoleGroupService
- type RoleGroupServiceImpl
- func (impl RoleGroupServiceImpl) CreateRoleGroup(request *bean.RoleGroup) (*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) DeleteRoleGroup(bean *bean.RoleGroup) (bool, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroups() ([]*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroupsById(id int32) (*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) FetchRoleGroupsByName(name string) ([]*bean.RoleGroup, error)
- func (impl RoleGroupServiceImpl) FetchRolesForGroups(groupNames []string) ([]*bean.RoleFilter, error)
- func (impl RoleGroupServiceImpl) UpdateRoleGroup(request *bean.RoleGroup) (*bean.RoleGroup, error)
- type SelfRegistrationRolesService
- type SelfRegistrationRolesServiceImpl
- type User
- type UserAudit
- type UserAuditService
- type UserAuditServiceImpl
- type UserAuthService
- type UserAuthServiceImpl
- func (impl UserAuthServiceImpl) AuthVerification(r *http.Request) (bool, error)
- func (impl UserAuthServiceImpl) CreateRole(roleData *bean.RoleData) (bool, error)
- func (impl UserAuthServiceImpl) DeleteRoles(entityType string, entityName string, tx *pg.Tx, envIdentifier string) (err error)
- func (impl UserAuthServiceImpl) HandleDexCallback(w http.ResponseWriter, r *http.Request)
- func (impl UserAuthServiceImpl) HandleLogin(username string, password string) (string, error)
- func (impl UserAuthServiceImpl) HandleRefresh(w http.ResponseWriter, r *http.Request)
- type UserCommonService
- type UserCommonServiceImpl
- func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies(userInfo *bean.UserInfo, existingRoleIds map[int]repository2.UserRoleModel, ...) ([]casbin2.Policy, error)
- func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroups(request *bean.RoleGroup, ...) ([]casbin2.Policy, error)
- type UserService
- type UserServiceImpl
- func (impl UserServiceImpl) CheckUserRoles(id int32) ([]string, error)
- func (impl UserServiceImpl) CreateUser(userInfo *bean.UserInfo) ([]*bean.UserInfo, error)
- func (impl UserServiceImpl) DeleteUser(bean *bean.UserInfo) (bool, error)
- func (impl UserServiceImpl) GetAll() ([]bean.UserInfo, error)
- func (impl UserServiceImpl) GetById(id int32) (*bean.UserInfo, error)
- func (impl UserServiceImpl) GetByIdIncludeDeleted(id int32) (*bean.UserInfo, error)
- func (impl UserServiceImpl) GetByIds(ids []int32) ([]bean.UserInfo, error)
- func (impl UserServiceImpl) GetEmailFromToken(token string) (string, error)
- func (impl UserServiceImpl) GetLoggedInUser(r *http.Request) (int32, error)
- func (impl UserServiceImpl) GetUserByEmail(emailId string) (*bean.UserInfo, error)
- func (impl UserServiceImpl) GetUserByToken(token string) (int32, string, error)
- func (impl UserServiceImpl) IsSuperAdmin(userId int) (bool, error)
- func (impl UserServiceImpl) SelfRegisterUserIfNotExists(userInfo *bean.UserInfo) ([]*bean.UserInfo, error)
- func (impl UserServiceImpl) SyncOrchestratorToCasbin() (bool, error)
- func (impl UserServiceImpl) UpdateTriggerPolicyForTerminalAccess() (err error)
- func (impl UserServiceImpl) UpdateUser(userInfo *bean.UserInfo) (*bean.UserInfo, error)
- func (impl UserServiceImpl) UserExists(emailId string) bool
- type WebhookToken
Constants ¶
View Source
const AllEnvironment string = ""
Variables ¶
View Source
var ( CookieExpirationTime int JwtExpirationTime int )
Functions ¶
func Authorizer ¶
func Authorizer(e *casbin.Enforcer, sessionManager *session.SessionManager) func(next http.Handler) http.Handler
Authorizer is a middleware for authorization
func WhitelistChecker ¶
Types ¶
type CheckResponse ¶
type DexConfig ¶
type DexConfig struct { RedirectURL string `env:"DEX_RURL" envDefault:"http://127.0.0.1:8080/callback"` ClientID string `env:"DEX_CID" envDefault:"example-app"` ClientSecret string `env:"DEX_SECRET" ` DexURL string `env:"DEX_URL" ` DexJwtKey string `env:"DEX_JWTKEY" ` CStoreKey string `env:"DEX_CSTOREKEY"` CookieExpirationTime int `env:"CExpirationTime" envDefault:"600"` JwtExpirationTime int `env:"JwtExpirationTime" envDefault:"120"` }
type RoleGroupService ¶
type RoleGroupService interface { CreateRoleGroup(request *bean.RoleGroup) (*bean.RoleGroup, error) UpdateRoleGroup(request *bean.RoleGroup) (*bean.RoleGroup, error) FetchRoleGroupsById(id int32) (*bean.RoleGroup, error) FetchRoleGroups() ([]*bean.RoleGroup, error) FetchRoleGroupsByName(name string) ([]*bean.RoleGroup, error) DeleteRoleGroup(model *bean.RoleGroup) (bool, error) FetchRolesForGroups(groupNames []string) ([]*bean.RoleFilter, error) }
type RoleGroupServiceImpl ¶
type RoleGroupServiceImpl struct {
// contains filtered or unexported fields
}
func NewRoleGroupServiceImpl ¶
func NewRoleGroupServiceImpl(userAuthRepository repository2.UserAuthRepository, logger *zap.SugaredLogger, userRepository repository2.UserRepository, roleGroupRepository repository2.RoleGroupRepository, userCommonService UserCommonService) *RoleGroupServiceImpl
func (RoleGroupServiceImpl) CreateRoleGroup ¶
func (RoleGroupServiceImpl) DeleteRoleGroup ¶
func (impl RoleGroupServiceImpl) DeleteRoleGroup(bean *bean.RoleGroup) (bool, error)
func (RoleGroupServiceImpl) FetchRoleGroups ¶
func (impl RoleGroupServiceImpl) FetchRoleGroups() ([]*bean.RoleGroup, error)
func (RoleGroupServiceImpl) FetchRoleGroupsById ¶
func (impl RoleGroupServiceImpl) FetchRoleGroupsById(id int32) (*bean.RoleGroup, error)
func (RoleGroupServiceImpl) FetchRoleGroupsByName ¶
func (impl RoleGroupServiceImpl) FetchRoleGroupsByName(name string) ([]*bean.RoleGroup, error)
func (RoleGroupServiceImpl) FetchRolesForGroups ¶
func (impl RoleGroupServiceImpl) FetchRolesForGroups(groupNames []string) ([]*bean.RoleFilter, error)
func (RoleGroupServiceImpl) UpdateRoleGroup ¶
type SelfRegistrationRolesService ¶
type SelfRegistrationRolesService interface { Check() (CheckResponse, error) SelfRegister(emailId string) }
type SelfRegistrationRolesServiceImpl ¶
type SelfRegistrationRolesServiceImpl struct {
// contains filtered or unexported fields
}
func NewSelfRegistrationRolesServiceImpl ¶
func NewSelfRegistrationRolesServiceImpl(logger *zap.SugaredLogger, selfRegistrationRolesRepository repository.SelfRegistrationRolesRepository, userService UserService) *SelfRegistrationRolesServiceImpl
func (*SelfRegistrationRolesServiceImpl) Check ¶
func (impl *SelfRegistrationRolesServiceImpl) Check() (CheckResponse, error)
func (*SelfRegistrationRolesServiceImpl) GetAll ¶
func (impl *SelfRegistrationRolesServiceImpl) GetAll() ([]string, error)
func (*SelfRegistrationRolesServiceImpl) SelfRegister ¶
func (impl *SelfRegistrationRolesServiceImpl) SelfRegister(emailId string)
type UserAuditService ¶
type UserAuditServiceImpl ¶
type UserAuditServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserAuditServiceImpl ¶
func NewUserAuditServiceImpl(logger *zap.SugaredLogger, userAuditRepository repository2.UserAuditRepository) *UserAuditServiceImpl
func (UserAuditServiceImpl) GetLatestByUserId ¶
func (impl UserAuditServiceImpl) GetLatestByUserId(userId int32) (*UserAudit, error)
func (UserAuditServiceImpl) Save ¶
func (impl UserAuditServiceImpl) Save(userAudit *UserAudit) error
type UserAuthService ¶
type UserAuthService interface { HandleLogin(username string, password string) (string, error) HandleDexCallback(w http.ResponseWriter, r *http.Request) HandleRefresh(w http.ResponseWriter, r *http.Request) CreateRole(roleData *bean.RoleData) (bool, error) AuthVerification(r *http.Request) (bool, error) DeleteRoles(entityType string, entityName string, tx *pg.Tx, envIdentifier string) error }
type UserAuthServiceImpl ¶
type UserAuthServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserAuthServiceImpl ¶
func NewUserAuthServiceImpl(userAuthRepository repository2.UserAuthRepository, sessionManager *middleware.SessionManager, client session2.ServiceClient, logger *zap.SugaredLogger, userRepository repository2.UserRepository, roleGroupRepository repository2.RoleGroupRepository) *UserAuthServiceImpl
func (UserAuthServiceImpl) AuthVerification ¶
func (impl UserAuthServiceImpl) AuthVerification(r *http.Request) (bool, error)
func (UserAuthServiceImpl) CreateRole ¶
func (impl UserAuthServiceImpl) CreateRole(roleData *bean.RoleData) (bool, error)
func (UserAuthServiceImpl) DeleteRoles ¶
func (UserAuthServiceImpl) HandleDexCallback ¶
func (impl UserAuthServiceImpl) HandleDexCallback(w http.ResponseWriter, r *http.Request)
func (UserAuthServiceImpl) HandleLogin ¶
func (impl UserAuthServiceImpl) HandleLogin(username string, password string) (string, error)
func (UserAuthServiceImpl) HandleRefresh ¶
func (impl UserAuthServiceImpl) HandleRefresh(w http.ResponseWriter, r *http.Request)
type UserCommonService ¶
type UserCommonService interface { RemoveRolesAndReturnEliminatedPolicies(userInfo *bean.UserInfo, existingRoleIds map[int]repository2.UserRoleModel, eliminatedRoleIds map[int]*repository2.UserRoleModel, tx *pg.Tx) ([]casbin2.Policy, error) RemoveRolesAndReturnEliminatedPoliciesForGroups(request *bean.RoleGroup, existingRoles map[int]*repository2.RoleGroupRoleMapping, eliminatedRoles map[int]*repository2.RoleGroupRoleMapping, tx *pg.Tx) ([]casbin2.Policy, error) }
type UserCommonServiceImpl ¶
type UserCommonServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserCommonServiceImpl ¶
func NewUserCommonServiceImpl(userAuthRepository repository2.UserAuthRepository, logger *zap.SugaredLogger, userRepository repository2.UserRepository, userGroupRepository repository2.RoleGroupRepository, sessionManager2 *middleware.SessionManager) *UserCommonServiceImpl
func (UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies ¶
func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPolicies(userInfo *bean.UserInfo, existingRoleIds map[int]repository2.UserRoleModel, eliminatedRoleIds map[int]*repository2.UserRoleModel, tx *pg.Tx) ([]casbin2.Policy, error)
func (UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroups ¶
func (impl UserCommonServiceImpl) RemoveRolesAndReturnEliminatedPoliciesForGroups(request *bean.RoleGroup, existingRoles map[int]*repository2.RoleGroupRoleMapping, eliminatedRoles map[int]*repository2.RoleGroupRoleMapping, tx *pg.Tx) ([]casbin2.Policy, error)
type UserService ¶
type UserService interface { CreateUser(userInfo *bean.UserInfo) ([]*bean.UserInfo, error) SelfRegisterUserIfNotExists(userInfo *bean.UserInfo) ([]*bean.UserInfo, error) UpdateUser(userInfo *bean.UserInfo) (*bean.UserInfo, error) GetById(id int32) (*bean.UserInfo, error) GetAll() ([]bean.UserInfo, error) GetEmailFromToken(token string) (string, error) GetLoggedInUser(r *http.Request) (int32, error) GetByIds(ids []int32) ([]bean.UserInfo, error) DeleteUser(userInfo *bean.UserInfo) (bool, error) CheckUserRoles(id int32) ([]string, error) SyncOrchestratorToCasbin() (bool, error) GetUserByToken(token string) (int32, string, error) IsSuperAdmin(userId int) (bool, error) GetByIdIncludeDeleted(id int32) (*bean.UserInfo, error) UserExists(emailId string) bool UpdateTriggerPolicyForTerminalAccess() (err error) }
type UserServiceImpl ¶
type UserServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserServiceImpl ¶
func NewUserServiceImpl(userAuthRepository repository2.UserAuthRepository, logger *zap.SugaredLogger, userRepository repository2.UserRepository, userGroupRepository repository2.RoleGroupRepository, sessionManager2 *middleware.SessionManager, userCommonService UserCommonService, userAuditService UserAuditService) *UserServiceImpl
func (UserServiceImpl) CheckUserRoles ¶
func (impl UserServiceImpl) CheckUserRoles(id int32) ([]string, error)
func (UserServiceImpl) CreateUser ¶
func (UserServiceImpl) DeleteUser ¶
func (impl UserServiceImpl) DeleteUser(bean *bean.UserInfo) (bool, error)
func (UserServiceImpl) GetAll ¶
func (impl UserServiceImpl) GetAll() ([]bean.UserInfo, error)
GetAll excluding API token user
func (UserServiceImpl) GetById ¶
func (impl UserServiceImpl) GetById(id int32) (*bean.UserInfo, error)
func (UserServiceImpl) GetByIdIncludeDeleted ¶
func (impl UserServiceImpl) GetByIdIncludeDeleted(id int32) (*bean.UserInfo, error)
func (UserServiceImpl) GetByIds ¶
func (impl UserServiceImpl) GetByIds(ids []int32) ([]bean.UserInfo, error)
func (UserServiceImpl) GetEmailFromToken ¶
func (impl UserServiceImpl) GetEmailFromToken(token string) (string, error)
func (UserServiceImpl) GetLoggedInUser ¶
func (impl UserServiceImpl) GetLoggedInUser(r *http.Request) (int32, error)
func (UserServiceImpl) GetUserByEmail ¶
func (impl UserServiceImpl) GetUserByEmail(emailId string) (*bean.UserInfo, error)
func (UserServiceImpl) GetUserByToken ¶
func (impl UserServiceImpl) GetUserByToken(token string) (int32, string, error)
func (UserServiceImpl) IsSuperAdmin ¶
func (impl UserServiceImpl) IsSuperAdmin(userId int) (bool, error)
func (UserServiceImpl) SelfRegisterUserIfNotExists ¶
func (UserServiceImpl) SyncOrchestratorToCasbin ¶
func (impl UserServiceImpl) SyncOrchestratorToCasbin() (bool, error)
func (UserServiceImpl) UpdateTriggerPolicyForTerminalAccess ¶
func (impl UserServiceImpl) UpdateTriggerPolicyForTerminalAccess() (err error)
func (UserServiceImpl) UpdateUser ¶
func (UserServiceImpl) UserExists ¶
func (impl UserServiceImpl) UserExists(emailId string) bool
type WebhookToken ¶
type WebhookToken struct {
WebhookToken string `env:"WEBHOOK_TOKEN" envDefault:""`
}
func GetWebhookToken ¶
func GetWebhookToken() (*WebhookToken, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.