Skip to content

Commit

Permalink
perf: remove user perm api when direct JMS-{token} ssh connection
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Oct 24, 2024
1 parent 95f9594 commit e51ec2b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/handler/server_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,17 @@ func (s *Server) SessionHandler(sess ssh.Session) {
directReq := sess.Context().Value(auth.ContextKeyDirectLoginFormat)
if pty, winChan, isPty := sess.Pty(); isPty && sess.RawCommand() == "" {
if directRequest, ok3 := directReq.(*auth.DirectLoginAssetReq); ok3 {
selectedAssets, err := s.getMatchedAssetsByDirectReq(user, directRequest)
if err != nil {
utils.IgnoreErrWriteString(sess, err.Error())
logger.Errorf("Get matched assets failed: %s", err)
return
}
opts := buildDirectRequestOptions(user, directRequest)
opts = append(opts, DirectTerminalConf(&termConf))
opts = append(opts, DirectAssets(selectedAssets))
if !directRequest.IsToken() {
selectedAssets, err := s.getMatchedAssetsByDirectReq(user, directRequest)
if err != nil {
utils.IgnoreErrWriteString(sess, err.Error())
logger.Errorf("Get matched assets failed: %s", err)
return
}
opts = append(opts, DirectAssets(selectedAssets))
}
directSrv := NewDirectHandler(sess, s.jmsService, opts...)
directSrv.Dispatch()
return
Expand Down

0 comments on commit e51ec2b

Please sign in to comment.