Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptECB(ciphertext string, key string) (string, error)
- func EncryptECB(plaintext string, key string) (string, error)
- func GenerateEncryptKey(key string) (string, error)
- func RegisterTerminalAccount(coreHost, name, token string) (res model.Terminal, err error)
- func ValidAccessKey(coreHost string, key model.AccessKey) error
- type AuthResponse
- type DataResponse
- type JMService
- func (s *JMService) CancelConfirmByRequestInfo(req model.ReqInfo) (err error)
- func (s *JMService) CheckConfirmStatusByRequestInfo(req model.ReqInfo) (res model.TicketState, err error)
- func (s *JMService) CheckIfNeedAssetLoginConfirm(userId, assetId, accountUsername string) (res model.AssetLoginTicketInfo, err error)
- func (s *JMService) CheckTokenStatus(tokenId string) (res model.TokenCheckStatus, err error)
- func (s *JMService) CheckUserCookie(cookies map[string]string) (user *model.User, err error)
- func (s *JMService) CloneClient() httplib.Client
- func (s *JMService) Copy() *JMService
- func (s *JMService) CreateFileOperationLog(data model.FTPLog) (err error)
- func (s *JMService) CreateSession(sess model.Session) (ret model.Session, err error)
- func (s *JMService) CreateSessionTicketRelation(sid, ticketId string) (err error)
- func (s *JMService) CreateShareRoom(data model.SharingSessionRequest) (res model.SharingSession, err error)
- func (s *JMService) CreateSuperConnectToken(data *SuperConnectTokenReq) (resp model.ConnectTokenInfo, err error)
- func (s *JMService) FinishFTPFile(fid string) error
- func (s *JMService) FinishReply(sid string) error
- func (s *JMService) FinishShareRoom(recordId string) (err error)
- func (s *JMService) FinishTask(tid string) error
- func (s *JMService) GetAccountSecretById(accountId string) (res model.AccountDetail, err error)
- func (s *JMService) GetAllUserPermsAssets(userId string) ([]model.PermAsset, error)
- func (s *JMService) GetAssetPlatform(assetId string) (platform model.Platform, err error)
- func (s *JMService) GetConnectTokenInfo(tokenId string) (resp model.ConnectToken, err error)
- func (s *JMService) GetDomainGateways(domainId string) (domain model.Domain, err error)
- func (s *JMService) GetEncryptedConfigValue(encryptKey, encryptedValue string) (resp ResultValue, err error)
- func (s *JMService) GetNodeTreeByUserAndNodeKey(userID, nodeKey string) (nodeTrees model.NodeTreeList, err error)
- func (s *JMService) GetProfile() (user *model.User, err error)
- func (s *JMService) GetPublicSetting() (result model.PublicSetting, err error)
- func (s *JMService) GetSessionById(sid string) (data model.Session, err error)
- func (s *JMService) GetShareUserInfo(query string) (res []*model.MiniUser, err error)
- func (s *JMService) GetTerminalConfig() (conf model.TerminalConfig, err error)
- func (s *JMService) GetUserAssetByID(userId, assetId string) (assets []model.PermAsset, err error)
- func (s *JMService) GetUserById(userID string) (user *model.User, err error)
- func (s *JMService) GetUserNodeAssets(userID, nodeID string, params model.PaginationParam) (resp model.PaginationResponse, err error)
- func (s *JMService) GetUserNodes(userId string) (nodes model.NodeList, err error)
- func (s *JMService) GetUserPermAssetById(userId, assetId string) (assets []model.PermAsset, err error)
- func (s *JMService) GetUserPermAssetDetailById(userId, assetId string) (resp model.PermAssetDetail, err error)
- func (s *JMService) GetUserPermAssetsByIP(userId, assetIP string) (assets []model.PermAsset, err error)
- func (s *JMService) GetUserPermsAssets(userId string, params model.PaginationParam) (resp model.PaginationResponse, err error)
- func (s *JMService) GetWsClient() (*websocket.Conn, error)
- func (s *JMService) JoinFaceMonitor(result JoinFaceMonitorRequest) error
- func (s *JMService) JoinShareRoom(data model.SharePostData) (res model.ShareRecord, err error)
- func (s *JMService) NotifyCommand(commands []*model.Command) (err error)
- func (s *JMService) PushSessionCommand(commands []*model.Command) (err error)
- func (s *JMService) RecordSessionLifecycleLog(sid string, event model.LifecycleEvent, logObj model.SessionLifecycleLog) (err error)
- func (s *JMService) RefreshUserAllPermsAssets(userId string) ([]model.PermAsset, error)
- func (s *JMService) RefreshUserNodes(userId string) (nodes model.NodeList, err error)
- func (s *JMService) SearchPermAsset(userId, key string) (res model.PermAssetList, err error)
- func (s *JMService) SessionDisconnect(sid string) error
- func (s *JMService) SessionFailed(sid string, err error) error
- func (s *JMService) SessionFinished(sid string, time common.UTCTime) error
- func (s *JMService) SessionReplayFailed(sid string, err model.ReplayError) error
- func (s *JMService) SessionSuccess(sid string) error
- func (s *JMService) SetCookie(name, value string)
- func (s *JMService) SetHeader(key, value string)
- func (s *JMService) SubmitCommandReview(sid string, aclId string, cmd string) (res model.CommandTicketInfo, err error)
- func (s *JMService) SyncUserKokoPreference(cookies map[string]string, data model.UserKokoPreference) (err error)
- func (s *JMService) TerminalHeartBeat(sIds []string) (res []model.TerminalTask, err error)
- func (s *JMService) UploadFTPFile(fid, file string) error
- func (s *JMService) UploadReplay(sid, gZipFile string) error
- func (s *JMService) ValidateJoinSessionPermission(userId, sessionId string) (result model.ValidateResult, err error)
- type JoinFaceMonitorRequest
- type OTPRequest
- type Option
- type ResultValue
- type SuperConnectTokenReq
- type UserClient
- func (u *UserClient) CancelConfirmAuth() (err error)
- func (u *UserClient) CheckConfirmAuthStatus() (resp AuthResponse, err error)
- func (u *UserClient) GetAPIToken() (resp AuthResponse, err error)
- func (u *UserClient) SelectMFAChoice(mfaType string) (err error)
- func (u *UserClient) SendOTPRequest(optReq *OTPRequest) (resp AuthResponse, err error)
- func (u *UserClient) SetOption(setters ...UserClientOption)
- type UserClientOption
- func UserClientHttpClient(con *httplib.Client) UserClientOption
- func UserClientLoginType(loginType string) UserClientOption
- func UserClientPassword(password string) UserClientOption
- func UserClientPublicKey(publicKey string) UserClientOption
- func UserClientRemoteAddr(remoteAddr string) UserClientOption
- func UserClientSvcSignKey(key model.AccessKey) UserClientOption
- func UserClientUsername(username string) UserClientOption
- type UserClientOptions
Constants ¶
View Source
const ( UserProfileURL = "/api/v1/users/profile/" // 获取当前用户的基本信息 TerminalRegisterURL = "/api/v1/terminal/terminal-registrations/" // 注册 TerminalConfigURL = "/api/v1/terminal/terminals/config/" // 获取配置 TerminalHeartBeatURL = "/api/v1/terminal/terminals/status/" TerminalEncryptedConfigURL = "/api/v1/terminal/encrypted-config/" )
与Core交互的API
View Source
const ( UserTokenAuthURL = "/api/v1/authentication/tokens/" // 用户登录验证 UserConfirmAuthURL = "/api/v1/authentication/login-confirm-ticket/status/" AuthMFASelectURL = "/api/v1/authentication/mfa/select/" // 选择 MFA )
用户登陆认证使用的API
View Source
const ( 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/" JoinRoomValidateURL = "/api/v1/terminal/sessions/join/validate/" FTPLogListURL = "/api/v1/audits/ftp-logs/" // 上传 ftp日志 FTPLogUpdateURL = "/api/v1/audits/ftp-logs/%s/" FTPLogFileURL = "/api/v1/audits/ftp-logs/%s/upload/" SessionLifecycleLogURL = "/api/v1/terminal/sessions/%s/lifecycle_log/" )
Session相关API
View Source
const ( UserPermsNodesListURL = "/api/v1/perms/users/%s/nodes/" UserPermsNodeAssetsListURL = "/api/v1/perms/users/%s/nodes/%s/assets/" UserPermsNodeTreeWithAssetURL = "/api/v1/perms/users/%s/nodes/children-with-assets/tree/" // 资产树 )
授权相关API
View Source
const ( UserListURL = "/api/v1/users/users/" UserDetailURL = "/api/v1/users/users/%s/" AssetPlatFormURL = "/api/v1/assets/assets/%s/platform/" DomainDetailWithGateways = "/api/v1/assets/domains/%s/?gateway=1" )
各资源详情相关API
View Source
const ()
View Source
const ( SuperConnectTokenSecretURL = "/api/v1/authentication/super-connection-token/secret/" SuperConnectTokenInfoURL = "/api/v1/authentication/super-connection-token/" SuperConnectTokenCheckURL = "/api/v1/authentication/super-connection-token/%s/check/" UserPermsAssetAccountsURL = "/api/v1/perms/users/%s/assets/%s/" AccountSecretURL = "/api/v1/assets/account-secrets/%s/" UserPermsAssetsURL = "/api/v1/perms/users/%s/assets/" AssetLoginConfirmURL = "/api/v1/acls/login-asset/check/" AclCommandReviewURL = "/api/v1/acls/command-filter-acls/command-review/" )
View Source
const ComponentName = "koko"
View Source
const (
FaceMonitorContextUrl = "/api/v1/authentication/face-monitor/context/"
)
View Source
const (
NotificationCommandURL = "/api/v1/terminal/commands/insecure-command/"
)
View Source
const (
PublicSettingURL = "/api/v1/settings/public/"
)
View Source
const (
TicketSessionURL = "/api/v1/tickets/ticket-session-relation/"
)
View Source
const (
UserKoKoPreferenceURL = "/api/v1/users/preference/?category=koko"
)
Variables ¶
View Source
var ( ErrConnect = errors.New("connect failed") ErrInvalid = errors.New("invalid user") )
View Source
var ConnectErr = errors.New("api connect err")
Functions ¶
func GenerateEncryptKey ¶
func RegisterTerminalAccount ¶
Types ¶
type AuthResponse ¶
type AuthResponse struct { Err string `json:"error,omitempty"` Msg string `json:"msg,omitempty"` Data DataResponse `json:"data,omitempty"` Username string `json:"username,omitempty"` Token string `json:"token,omitempty"` Keyword string `json:"keyword,omitempty"` DateExpired string `json:"date_expired,omitempty"` User model.User `json:"user,omitempty"` }
type DataResponse ¶
type JMService ¶
func NewAuthJMService ¶
func (*JMService) CancelConfirmByRequestInfo ¶
func (*JMService) CheckConfirmStatusByRequestInfo ¶
func (*JMService) CheckIfNeedAssetLoginConfirm ¶
func (s *JMService) CheckIfNeedAssetLoginConfirm(userId, assetId, accountUsername string) (res model.AssetLoginTicketInfo, err error)
func (*JMService) CheckTokenStatus ¶
func (s *JMService) CheckTokenStatus(tokenId string) (res model.TokenCheckStatus, err error)
func (*JMService) CheckUserCookie ¶
func (*JMService) CloneClient ¶
func (*JMService) CreateFileOperationLog ¶
func (*JMService) CreateSession ¶
func (*JMService) CreateSessionTicketRelation ¶
func (*JMService) CreateShareRoom ¶
func (s *JMService) CreateShareRoom(data model.SharingSessionRequest) (res model.SharingSession, err error)
func (*JMService) CreateSuperConnectToken ¶
func (s *JMService) CreateSuperConnectToken(data *SuperConnectTokenReq) (resp model.ConnectTokenInfo, err error)
func (*JMService) FinishFTPFile ¶
func (*JMService) FinishReply ¶
func (*JMService) FinishShareRoom ¶
func (*JMService) FinishTask ¶
func (*JMService) GetAccountSecretById ¶
func (s *JMService) GetAccountSecretById(accountId string) (res model.AccountDetail, err error)
func (*JMService) GetAllUserPermsAssets ¶
func (*JMService) GetAssetPlatform ¶
func (*JMService) GetConnectTokenInfo ¶
func (s *JMService) GetConnectTokenInfo(tokenId string) (resp model.ConnectToken, err error)
func (*JMService) GetDomainGateways ¶
func (*JMService) GetEncryptedConfigValue ¶
func (s *JMService) GetEncryptedConfigValue(encryptKey, encryptedValue string) (resp ResultValue, err error)
func (*JMService) GetNodeTreeByUserAndNodeKey ¶
func (s *JMService) GetNodeTreeByUserAndNodeKey(userID, nodeKey string) (nodeTrees model.NodeTreeList, err error)
func (*JMService) GetPublicSetting ¶
func (s *JMService) GetPublicSetting() (result model.PublicSetting, err error)
func (*JMService) GetSessionById ¶
func (*JMService) GetShareUserInfo ¶
func (*JMService) GetTerminalConfig ¶
func (s *JMService) GetTerminalConfig() (conf model.TerminalConfig, err error)
func (*JMService) GetUserAssetByID ¶
func (*JMService) GetUserById ¶
func (*JMService) GetUserNodeAssets ¶
func (s *JMService) GetUserNodeAssets(userID, nodeID string, params model.PaginationParam) (resp model.PaginationResponse, err error)
func (*JMService) GetUserNodes ¶
func (*JMService) GetUserPermAssetById ¶
func (*JMService) GetUserPermAssetDetailById ¶
func (s *JMService) GetUserPermAssetDetailById(userId, assetId string) (resp model.PermAssetDetail, err error)
func (*JMService) GetUserPermAssetsByIP ¶
func (*JMService) GetUserPermsAssets ¶
func (s *JMService) GetUserPermsAssets(userId string, params model.PaginationParam) (resp model.PaginationResponse, err error)
func (*JMService) JoinFaceMonitor ¶
func (s *JMService) JoinFaceMonitor(result JoinFaceMonitorRequest) error
func (*JMService) JoinShareRoom ¶
func (s *JMService) JoinShareRoom(data model.SharePostData) (res model.ShareRecord, err error)
func (*JMService) NotifyCommand ¶
func (*JMService) PushSessionCommand ¶
func (*JMService) RecordSessionLifecycleLog ¶
func (s *JMService) RecordSessionLifecycleLog(sid string, event model.LifecycleEvent, logObj model.SessionLifecycleLog) (err error)
func (*JMService) RefreshUserAllPermsAssets ¶
func (*JMService) RefreshUserNodes ¶
func (*JMService) SearchPermAsset ¶
func (s *JMService) SearchPermAsset(userId, key string) (res model.PermAssetList, err error)
func (*JMService) SessionDisconnect ¶
func (*JMService) SessionFinished ¶
func (*JMService) SessionReplayFailed ¶
func (s *JMService) SessionReplayFailed(sid string, err model.ReplayError) error
func (*JMService) SessionSuccess ¶
func (*JMService) SubmitCommandReview ¶
func (*JMService) SyncUserKokoPreference ¶
func (*JMService) TerminalHeartBeat ¶
func (s *JMService) TerminalHeartBeat(sIds []string) (res []model.TerminalTask, err error)
func (*JMService) UploadFTPFile ¶
func (*JMService) UploadReplay ¶
func (*JMService) ValidateJoinSessionPermission ¶
func (s *JMService) ValidateJoinSessionPermission(userId, sessionId string) (result model.ValidateResult, err error)
type JoinFaceMonitorRequest ¶
type OTPRequest ¶
type ResultValue ¶
type ResultValue struct {
Value string `json:"value"`
}
type SuperConnectTokenReq ¶
type SuperConnectTokenReq struct { UserId string `json:"user"` AssetId string `json:"asset"` Account string `json:"account"` Protocol string `json:"protocol"` ConnectMethod string `json:"connect_method"` InputUsername string `json:"input_username"` InputSecret string `json:"input_secret"` RemoteAddr string `json:"remote_addr"` Params map[string]string `json:"-"` }
type UserClient ¶
type UserClient struct { Opts *UserClientOptions // contains filtered or unexported fields }
func NewUserClient ¶
func NewUserClient(setters ...UserClientOption) *UserClient
func (*UserClient) CancelConfirmAuth ¶
func (u *UserClient) CancelConfirmAuth() (err error)
func (*UserClient) CheckConfirmAuthStatus ¶
func (u *UserClient) CheckConfirmAuthStatus() (resp AuthResponse, err error)
func (*UserClient) GetAPIToken ¶
func (u *UserClient) GetAPIToken() (resp AuthResponse, err error)
func (*UserClient) SelectMFAChoice ¶
func (u *UserClient) SelectMFAChoice(mfaType string) (err error)
func (*UserClient) SendOTPRequest ¶
func (u *UserClient) SendOTPRequest(optReq *OTPRequest) (resp AuthResponse, err error)
func (*UserClient) SetOption ¶
func (u *UserClient) SetOption(setters ...UserClientOption)
type UserClientOption ¶
type UserClientOption func(*UserClientOptions)
func UserClientHttpClient ¶
func UserClientHttpClient(con *httplib.Client) UserClientOption
func UserClientLoginType ¶
func UserClientLoginType(loginType string) UserClientOption
func UserClientPassword ¶
func UserClientPassword(password string) UserClientOption
func UserClientPublicKey ¶
func UserClientPublicKey(publicKey string) UserClientOption
func UserClientRemoteAddr ¶
func UserClientRemoteAddr(remoteAddr string) UserClientOption
func UserClientSvcSignKey ¶
func UserClientSvcSignKey(key model.AccessKey) UserClientOption
func UserClientUsername ¶
func UserClientUsername(username string) UserClientOption
Source Files ¶
- jms.go
- jms_asset.go
- jms_audit.go
- jms_face_callback.go
- jms_filter_rules.go
- jms_heartbeat.go
- jms_perm_asset.go
- jms_perm_node.go
- jms_perm_node_tree.go
- jms_permission.go
- jms_public_setting.go
- jms_session.go
- jms_session_record.go
- jms_share.go
- jms_task.go
- jms_terminal.go
- jms_ticket.go
- jms_token.go
- jms_user.go
- options.go
- register.go
- url.go
- user_client.go
Click to show internal directories.
Click to hide internal directories.