// RevokeSession revokes one specific session of the user with the
// active session in the request's context.
RevokeSession revokes one specific session of the user with the
active session in the request's context.
// RevokeSession revokes one specific session of the user with the // active session in the request ' s context .
func (h *Handler) RevokeSession(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	ses, _, err := httpflow.ExtractSession(ctx)
	if err != nil {
		httpflow.RespondError(h.log, w, r, err)
		return
	}
	id, err := httpflow.ExtractParam(r, "id")
	if err != nil {
		httpflow.RespondError(h.log, w, r, err)
		return
	}
	if ses.ID == id {
		err = httpflow.NewError(nil, http.StatusBadRequest, "current session cannot be revoked")
		httpflow.RespondError(h.log, w, r, err)
		return
	}
	if err = h.session.manager.RevokeByIDExt(ctx, id); err != nil {
		httpflow.RespondError(h.log, w, r, err)
		return
	}
	httpflow.Respond(h.log, w, r, nil, http.StatusNoContent)
}
func ( h * Handler ) RevokeSession ( w http . ResponseWriter , r * http . Request ) { ctx := r . Context ( ) ses , _ , err := httpflow . ExtractSession ( ctx ) if err != nil { httpflow . RespondError ( h . log , w , r , err ) return } id , err := httpflow . ExtractParam ( r , " " ) if err != nil { httpflow . RespondError ( h . log , w , r , err ) return } if ses . ID == id { err = httpflow . NewError ( nil , http . StatusBadRequest , " " ) httpflow . RespondError ( h . log , w , r , err ) return } if err = h . session . manager . RevokeByIDExt ( ctx , id ) ; err != nil { httpflow . RespondError ( h . log , w , r , err ) return } httpflow . Respond ( h . log , w , r , nil , http . StatusNoContent ) }
RevokeSession revokes one specific session of the user with the
active session in the request's context.
RevokeSession revokes one specific session of the user with the active session in the request ' s context .