@@ -230,12 +230,15 @@ func (s *Server) handleAdmin(w http.ResponseWriter, r *http.Request) {
230230 // connector gave the user, refresh tokens under the encoded sub claim
231231 // that ends up in tokens.
232232 if data .UserID != "" {
233- if resp , err := s .admin .api .ListAuthSessions (ctx , & api.ListAuthSessionsReq {UserId : data .UserID }); err == nil {
233+ req := & api.ListAuthSessionsReq {UserId : data .UserID , ConnectorId : data .ConnectorID }
234+ if resp , err := s .admin .api .ListAuthSessions (ctx , req ); err == nil {
234235 for _ , sess := range resp .Sessions {
235236 data .Sessions = append (data .Sessions , AdminSession {
237+ ID : sess .Id ,
236238 UserID : sess .UserId ,
237239 ConnectorID : sess .ConnectorId ,
238240 IPAddress : sess .IpAddress ,
241+ UserAgent : sess .UserAgent ,
239242 Created : epochText (sess .CreatedAt ),
240243 Expires : epochText (sess .AbsoluteExpiry ),
241244 })
@@ -446,9 +449,11 @@ func (s *Server) handleAdminRevokeRefresh(w http.ResponseWriter, r *http.Request
446449 ctx , cancel := context .WithTimeout (r .Context (), 10 * time .Second )
447450 defer cancel ()
448451
452+ // The API keys refresh tokens by the sub claim, not by the user id the
453+ // connector gave — the same encoding the listing above uses.
449454 userID , clientID := r .FormValue ("user_id" ), r .FormValue ("client_id" )
450455 resp , err := s .admin .api .RevokeRefresh (ctx , & api.RevokeRefreshReq {
451- UserId : userID ,
456+ UserId : idTokenSubject ( userID , r . FormValue ( "connector_id" )) ,
452457 ClientId : clientID ,
453458 })
454459 switch {
@@ -680,18 +685,16 @@ func (s *Server) handleAdminDeleteSession(w http.ResponseWriter, r *http.Request
680685 ctx , cancel := context .WithTimeout (r .Context (), 10 * time .Second )
681686 defer cancel ()
682687
683- userID := r .FormValue ("user_id" )
684- resp , err := s .admin .api .DeleteAuthSession (ctx , & api.DeleteAuthSessionReq {
685- UserId : userID ,
686- ConnectorId : r .FormValue ("connector_id" ),
687- })
688+ // One session is one signed-in browser, so this ends that device and no other.
689+ sessionID := r .FormValue ("session_id" )
690+ resp , err := s .admin .api .DeleteAuthSession (ctx , & api.DeleteAuthSessionReq {Id : sessionID })
688691 switch {
689692 case err != nil :
690693 s .adminRedirect (w , r , "" , err .Error ())
691694 case resp .NotFound :
692- s .adminRedirect (w , r , "" , fmt .Sprintf ("no session for user %q" , userID ))
695+ s .adminRedirect (w , r , "" , fmt .Sprintf ("no session %q" , sessionID ))
693696 default :
694- s .adminRedirect (w , r , fmt .Sprintf ("deleted session for user %q" , userID ), "" )
697+ s .adminRedirect (w , r , fmt .Sprintf ("deleted session %q" , sessionID ), "" )
695698 }
696699}
697700
0 commit comments