From nobody Fri Apr 19 03:12:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557755597; cv=none; d=zoho.com; s=zohoarc; b=f0kleWarPqpFNkFFVnFql54RIyfRyNHZUfWPcaTfLhI46VqKfh54ENzCLj2HJoyutvDvdjKrSyrEPCTms0s1Ytmz5EZYUchxUFOvgHVv1QNwBdOAEXR6GLzGWUClorIHloZd4hKuvNaQp6ot0XB6DRtgawVv01YK8WdAULU1oYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557755597; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ApoXHJVY+W5k9Zn0V4Fj1FTprxhSdewvHCdqS5Vl0Us=; b=FL5RjnxhylL1fjiaDod3NF1Be3UPiQbb4i3ArT5DtDKVlaeVqreYKttguROEIhtBu6voCr4tTuXDhriDDjv19JI5Rf85wqLq+xrJeQQ7jKw2wtsBXYGX+5gOk0FjtbhDMxcA5iPyX7dKvg4fYonNjL4m8lLuZNTKUOSQr1rXFJ8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1557755597641182.8599193176267; Mon, 13 May 2019 06:53:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 792B9307D868; Mon, 13 May 2019 13:53:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DCCA19C6F; Mon, 13 May 2019 13:53:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 65C3318089CC; Mon, 13 May 2019 13:53:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4DDrEXK025255 for ; Mon, 13 May 2019 09:53:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id C88C919C67; Mon, 13 May 2019 13:53:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C32F419C72 for ; Mon, 13 May 2019 13:53:14 +0000 (UTC) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5646D5F79C for ; Mon, 13 May 2019 13:53:03 +0000 (UTC) Received: by mail-wm1-f50.google.com with SMTP id f2so13814180wmj.3 for ; Mon, 13 May 2019 06:53:03 -0700 (PDT) Received: from localhost.localdomain ([212.140.138.203]) by smtp.gmail.com with ESMTPSA id 34sm5456970wre.32.2019.05.13.06.53.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2019 06:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nCAFDvlon1Mk/YdwJ40taWyeIMvK9wydtjB7QRZbvoc=; b=Fhv4A3i0kYKCWoTChK8Ip/gEav6Bv3ikVxJiqgPPkg6cCGKEORa1TsJNo/Yr7ABEhF MLAmhEMFL5EKUrgvCQ0n6ZYoUTXXtRnM++0xJcqhtb/DbwJPIVTbxAzSMh3HShRjii8l v2NGowE7V3oKRRfQthLSswsyxjCxyYnrmgHaQZj5Fb7wTb/Hm+uEiI75R1jnyAXk3713 yUZFRjgk0f8/Otyw++xDA3PqxwmfhOVBHnSxj7pbKPA8nUEgbVI0svKcR34vshK4NIQk t0P/044Lf3SHyJ8BZCx0e92VE07TJ5idktpQATIKz5dycRKQC2i3YsjHCtBN5AH1y1/H GRYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=nCAFDvlon1Mk/YdwJ40taWyeIMvK9wydtjB7QRZbvoc=; b=TlClYQn6kYaS3TzO1PlFTkjX3S8nAZ/Zmf7Cluvj1LIhhPHHL+7IugYKtq2TAm/cdC nC3y+5PuceN9carJLJGDSLIijm/dbuKs4sRtpVHI7qnYscG4WBwf7skIT0F7GkTXg+ED OMUPIVX5NoOeVTSifQ6Yax4n3GyjcUtSsDwfOnkp9UuY7jV0l5vsRcs/XOVbGEBskYmP pamLwEVQrxyJ7jvwdwrl5Vw99fuzhD9VqqGEZ3edFpeZo3UBZrj8Kvtgocu0QVhE7ncN /AO8qvKgZkiMfNPRdqEmEgLejAkPhATqT+EVnRjMy+HUNEWls7fxZgxwo9+yCZ9diaUk BV0g== X-Gm-Message-State: APjAAAWoPVRyIIlwOVfY6al3twFf/J7m6Dl5eNgcSoL9oGhfJHfhWL6r C8hEW+IjpDhHZDgXABDS5qRCiJdLp9Y= X-Google-Smtp-Source: APXvYqzZSR/Y/lfk1jYmm20Fvc1642vYRBb9IjDr4N26pETdZWW1DA5KkqnhOneDcluXke9RKZoXXQ== X-Received: by 2002:a1c:eb18:: with SMTP id j24mr16593173wmh.32.1557755581699; Mon, 13 May 2019 06:53:01 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Mon, 13 May 2019 15:52:56 +0200 Message-Id: <20190513135256.15125-4-pbonzini@redhat.com> In-Reply-To: <20190513135256.15125-1-pbonzini@redhat.com> References: <20190513135256.15125-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 13 May 2019 13:53:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 13 May 2019 13:53:03 +0000 (UTC) for IP:'209.85.128.50' DOMAIN:'mail-wm1-f50.google.com' HELO:'mail-wm1-f50.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.002 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_PASS) 209.85.128.50 mail-wm1-f50.google.com 209.85.128.50 mail-wm1-f50.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 3/3] rest: add rest_auth support X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 13 May 2019 13:53:16 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This adds API endpoints /api/v1/users/{login,logout}/ that can be used to obtain an authentication token. --- api/urls.py | 4 ++++ patchew/settings.py | 1 + requirements.txt | 1 + 3 files changed, 6 insertions(+) diff --git a/api/urls.py b/api/urls.py index f71a5e4..b1e259f 100644 --- a/api/urls.py +++ b/api/urls.py @@ -8,6 +8,8 @@ # This work is licensed under the MIT License. Please see the LICENSE fil= e or # http://opensource.org/licenses/MIT. =20 +from rest_auth.views import LoginView, LogoutView + from django.conf.urls import url, include from rest_framework.routers import DefaultRouter from rest_framework_nested.routers import NestedDefaultRouter @@ -49,6 +51,8 @@ results_router.register('results', rest.SeriesResultsView= Set, base_name=3D'results schema_view =3D get_schema_view(title=3D'API schema') =20 urlpatterns =3D _build_urls() + [ + url(r'^v1/users/login/$', LoginView.as_view(), name=3D'rest_login'), + url(r'^v1/users/logout/$', LogoutView.as_view(), name=3D'rest_logout'), url(r"^v1/", include(router.urls)), url(r"^v1/", include(projects_router.urls)), url(r"^v1/", include(results_router.urls)), diff --git a/patchew/settings.py b/patchew/settings.py index dead744..4e10b44 100644 --- a/patchew/settings.py +++ b/patchew/settings.py @@ -46,6 +46,7 @@ INSTALLED_APPS =3D [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'rest_auth', 'rest_framework', 'rest_framework.authtoken', ] diff --git a/requirements.txt b/requirements.txt index 59c9480..a03dbe7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,7 @@ gunicorn>=3D19 djangorestframework>=3D3.0.0 jsonfield2 >=3D 3.0, < 4.0 drf-nested-routers +django-rest-auth>=3D0.9.0 coreapi-cli pyyaml psycopg2 --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel