Documentation ¶
Index ¶
- Constants
- Variables
- func CheckUserCookie(sessionID, csrfToken string) (user *model.User, err error)
- func CreateSession(data map[string]interface{}) bool
- func FinishReply(sid string) bool
- func FinishSession(data map[string]interface{})
- func FinishTask(tid string) bool
- func ForceRefreshUserPemAssets(userID string) error
- func GetAsset(assetID string) (asset model.Asset)
- func GetAssetGateways(assetID string) (gateways []model.Gateway)
- func GetDatabase(dbID string) (res model.Database)
- func GetDomainWithGateway(gID string) (domain model.Domain)
- func GetProfile() (user *model.User, err error)
- func GetSystemUser(systemUserID string) (info model.SystemUser)
- func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info model.SystemUserAuthInfo)
- func GetSystemUserDatabaseAuthInfo(systemUserID string) (info model.SystemUserAuthInfo)
- func GetSystemUserFilterRules(systemUserID string) (rules []model.SystemUserFilterRule, err error)
- func GetTokenAsset(token string) (tokenUser model.TokenUser)
- func GetUserAllAssets(userID string) (assets []model.Asset)
- func GetUserAssetAuthInfo(systemUserID, assetID, userID, username string) (info model.SystemUserAuthInfo)
- func GetUserAssetByID(userID, assertID string) (assets []model.Asset)
- func GetUserAssetSystemUsers(userID, assetID string) (sysUsers []model.SystemUser)
- func GetUserAssets(userID string, pageSize, offset int, searches ...string) (resp model.AssetsPaginationResponse)
- func GetUserByUsername(username string) (user *model.User, err error)
- func GetUserDatabaseSystemUsers(userID, assetID string) (sysUsers []model.SystemUser)
- func GetUserDatabases(uid string) (res []model.Database)
- func GetUserDetail(userID string) (user *model.User)
- func GetUserNodeAssets(userID, nodeID, cachePolicy string) (assets model.AssetList)
- func GetUserNodePaginationAssets(userID, nodeID string, pageSize, offset int, searches ...string) (resp model.AssetsPaginationResponse)
- func GetUserNodeTreeWithAsset(userID, nodeID, cachePolicy string) (nodeTrees model.NodeTreeList)
- func GetUserNodes(userID, cachePolicy string) (nodes model.NodeList)
- func Initial(ctx context.Context)
- func JoinRoomValidate(userID, sessionID string) bool
- func KeepSyncConfigWithServer(ctx context.Context)
- func LoadConfigFromServer() (err error)
- func MustLoadServerConfigOnce()
- func PushFTPLog(data *model.FTPLog) (err error)
- func PushSessionCommand(commands []*model.Command) (err error)
- func PushSessionReplay(sessionID, gZipFile string) (err error)
- func RegisterTerminal(name, token, comment string) (res model.Terminal)
- func SearchPermAsset(uid, key string) (res model.NodeTreeList, err error)
- func TerminalHeartBeat(sIds []string) (res []model.TerminalTask)
- func ValidateUserAssetPermission(userID, assetID, systemUserID, action string) bool
- func ValidateUserDatabasePermission(userID, databaseID, systemUserID string) bool
- type AccessKey
- type AuthOptions
- type AuthStatus
- type SessionClient
- func (u *SessionClient) Authenticate(ctx context.Context) (user model.User, authStatus AuthStatus)
- func (u *SessionClient) CancelConfirm()
- func (u *SessionClient) CheckConfirm(ctx context.Context) (user model.User, authStatus AuthStatus)
- func (u *SessionClient) CheckUserOTP(ctx context.Context, code string) (user model.User, authStatus AuthStatus)
- func (u *SessionClient) SetOption(setters ...SessionOption)
- type SessionOption
- type SessionOptions
Constants ¶
View Source
const ( ErrLoginConfirmWait = "login_confirm_wait" ErrLoginConfirmRejected = "login_confirm_rejected" ErrLoginConfirmRequired = "login_confirm_required" ErrMFARequired = "mfa_required" ErrPasswordFailed = "password_failed" )
View Source
const ( UserProfileURL = "/api/v1/users/profile/" // 获取当前用户的基本信息 UserListURL = "/api/v1/users/users/" // 用户列表地址 UserDetailURL = "/api/v1/users/users/%s/" // 获取用户信息 TokenAssetURL = "/api/v1/authentication/connection-token/?token=%s" // Token name SystemUserAssetAuthURL = "/api/v1/assets/system-users/%s/assets/%s/auth-info/" // 该系统用户对某资产的授权 SystemUserCmdFilterRulesListURL = "/api/v1/assets/system-users/%s/cmd-filter-rules/" // 过滤规则url SystemUserDetailURL = "/api/v1/assets/system-users/%s/" // 某个系统用户的信息 AssetDetailURL = "/api/v1/assets/assets/%s/" // 某一个资产信息 DomainDetailURL = "/api/v1/assets/domains/%s/?gateway=1" TerminalRegisterURL = "/api/v2/terminal/terminal-registrations/" // 注册当前coco TerminalConfigURL = "/api/v1/terminal/terminals/config/" // 从jumpserver获取coco的配置 TerminalHeartBeatURL = "/api/v1/terminal/terminals/status/" SessionListURL = "/api/v1/terminal/sessions/" //上传创建的资产会话session id SessionDetailURL = "/api/v1/terminal/sessions/%s/" // finish session的时候发送 SessionReplayURL = "/api/v1/terminal/sessions/%s/replay/" //上传录像 SessionCommandURL = "/api/v1/terminal/commands/" //上传批量命令 FinishTaskURL = "/api/v1/terminal/tasks/%s/" FTPLogListURL = "/api/v1/audits/ftp-logs/" // 上传 ftp日志 UserAssetsURL = "/api/v1/perms/users/%s/assets/" //获取用户授权的所有资产 UserNodesAssetsURL = "/api/v1/perms/users/%s/nodes-assets/" // 获取用户授权的所有节点信息 节点分组 UserNodesListURL = "/api/v1/perms/users/%s/nodes/" UserNodeAssetsListURL = "/api/v1/perms/users/%s/nodes/%s/assets/" ValidateUserAssetPermissionURL = "/api/v1/perms/asset-permissions/user/validate/" //0不使用缓存 1 使用缓存 2 刷新缓存 )
View Source
const ( UserTokenAuthURL = "/api/v1/authentication/tokens/" // 用户登录验证 UserConfirmAuthURL = "/api/v1/authentication/login-confirm-ticket/status/" NodeTreeWithAssetURL = "/api/v1/perms/users/%s/nodes/children-with-assets/tree/" // 资产树 DatabaseAPPURL = "/api/v1/perms/users/%s/database-apps/" //数据库app UserDatabaseSystemUsersURL = "/api/v1/perms/users/%s/database-apps/%s/system-users/" SystemUserAuthURL = "/api/v1/assets/system-users/%s/auth-info/" UserAssetsTreeURL = "/api/v1/perms/users/%s/assets/tree/" DatabaseDetailURL = "/api/v1/applications/database-apps/%s/" ValidateUserDatabasePermissionURL = "/api/v1/perms/database-app-permissions/user/validate/" )
1.5.5
View Source
const (
AssetGatewaysURL = "/api/v1/assets/assets/%s/gateways/"
)
1.5.7
View Source
const (
JoinRoomValidateURL = "/api/v1/terminal/sessions/join/validate/"
)
View Source
const (
UserAssetSystemUsersURL = "/api/v1/perms/users/%s/assets/%s/system-users/" // 获取用户授权资产的系统用户列表
)
Variables ¶
Functions ¶
func CheckUserCookie ¶
func CreateSession ¶
func FinishReply ¶
func FinishSession ¶
func FinishSession(data map[string]interface{})
func FinishTask ¶
func GetAssetGateways ¶
func GetDatabase ¶
func GetDomainWithGateway ¶
func GetProfile ¶
func GetSystemUser ¶
func GetSystemUser(systemUserID string) (info model.SystemUser)
func GetSystemUserAssetAuthInfo ¶
func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info model.SystemUserAuthInfo)
func GetSystemUserDatabaseAuthInfo ¶
func GetSystemUserDatabaseAuthInfo(systemUserID string) (info model.SystemUserAuthInfo)
func GetSystemUserFilterRules ¶
func GetSystemUserFilterRules(systemUserID string) (rules []model.SystemUserFilterRule, err error)
func GetTokenAsset ¶
func GetUserAllAssets ¶
func GetUserAssetAuthInfo ¶
func GetUserAssetAuthInfo(systemUserID, assetID, userID, username string) (info model.SystemUserAuthInfo)
func GetUserAssetByID ¶
func GetUserAssetSystemUsers ¶
func GetUserAssetSystemUsers(userID, assetID string) (sysUsers []model.SystemUser)
func GetUserAssets ¶
func GetUserAssets(userID string, pageSize, offset int, searches ...string) (resp model.AssetsPaginationResponse)
func GetUserDatabaseSystemUsers ¶
func GetUserDatabaseSystemUsers(userID, assetID string) (sysUsers []model.SystemUser)
func GetUserDatabases ¶
func GetUserDetail ¶
func GetUserNodeAssets ¶
func GetUserNodePaginationAssets ¶
func GetUserNodePaginationAssets(userID, nodeID string, pageSize, offset int, searches ...string) (resp model.AssetsPaginationResponse)
func GetUserNodeTreeWithAsset ¶
func GetUserNodeTreeWithAsset(userID, nodeID, cachePolicy string) (nodeTrees model.NodeTreeList)
func GetUserNodes ¶
func JoinRoomValidate ¶
func LoadConfigFromServer ¶
func LoadConfigFromServer() (err error)
func MustLoadServerConfigOnce ¶
func MustLoadServerConfigOnce()
func PushFTPLog ¶
func PushSessionCommand ¶
func PushSessionReplay ¶
func RegisterTerminal ¶
func SearchPermAsset ¶
func SearchPermAsset(uid, key string) (res model.NodeTreeList, err error)
func TerminalHeartBeat ¶
func TerminalHeartBeat(sIds []string) (res []model.TerminalTask)
Types ¶
type AccessKey ¶
func (*AccessKey) LoadAccessKeyFromFile ¶
func (*AccessKey) LoadAccessKeyFromStr ¶
func (*AccessKey) SaveToFile ¶
type AuthOptions ¶
type AuthStatus ¶
type AuthStatus int64
const ( AuthSuccess AuthStatus = iota + 1 AuthFailed AuthMFARequired AuthConfirmRequired )
type SessionClient ¶
type SessionClient struct {
// contains filtered or unexported fields
}
func NewSessionClient ¶
func NewSessionClient(setters ...SessionOption) SessionClient
func (*SessionClient) Authenticate ¶
func (u *SessionClient) Authenticate(ctx context.Context) (user model.User, authStatus AuthStatus)
func (*SessionClient) CancelConfirm ¶
func (u *SessionClient) CancelConfirm()
func (*SessionClient) CheckConfirm ¶
func (u *SessionClient) CheckConfirm(ctx context.Context) (user model.User, authStatus AuthStatus)
func (*SessionClient) CheckUserOTP ¶
func (u *SessionClient) CheckUserOTP(ctx context.Context, code string) (user model.User, authStatus AuthStatus)
func (*SessionClient) SetOption ¶
func (u *SessionClient) SetOption(setters ...SessionOption)
type SessionOption ¶
type SessionOption func(*SessionOptions)
func LoginType ¶
func LoginType(loginType string) SessionOption
func Password ¶
func Password(password string) SessionOption
func PublicKey ¶
func PublicKey(publicKey string) SessionOption
func RemoteAddr ¶
func RemoteAddr(remoteAddr string) SessionOption
func Username ¶
func Username(username string) SessionOption
Click to show internal directories.
Click to hide internal directories.