바뀜
편집 요약 없음
== 개요 ==
== 개요 ==
django-oauth-toolkit을 통해 OAuth2.0 로그인을 제공한다.
django-oauth-toolkit을 통해 OAuth2.0 로그인을 제공한다. 공식 문서(https://django-oauth-toolkit.readthedocs.io/en/latest/)
애시당초 공급을 목표로 하는 라이브러리.
이미 로그인 뷰 등 기본적인 서비스는 구현된 상태라 가정한다.
이미 로그인 뷰 등 기본적인 서비스는 구현된 상태라 가정한다.
path('OAuth2.0/detail/<int:pk>', views.OAuth_client_edit, name='OAuth_client_edit'),
path('OAuth2.0/detail/<int:pk>', views.OAuth_client_edit, name='OAuth_client_edit'),
path('OAuth2.0/register', views.OAuth_register_client, name='OAuth_register_client'),
path('OAuth2.0/register', views.OAuth_register_client, name='OAuth_register_client'),
path('OAuth2.0/delete/<int:pk>', views.OAuth_delete_client, name='OAuth_delete_client'),
</syntaxhighlight>
</syntaxhighlight>
|예시. 각 사정에 맞게 설정.
|예시. 각 사정에 맞게 설정.
else:
else:
form = ClientRegisterForm()
form = ClientRegisterForm()
return render(request, 'custom_account/OAuth2/register.html', {'form': form})
@login_required
def OAuth_delete_client(request, pk):
'''어플리케이션 등록.'''
app = get_object_or_404(Application, pk=pk, user=request.user)
if app.user == request.user:
app.delete()
return redirect('custom_account:OAuth_client_list')
return render(request, 'custom_account/OAuth2/register.html', {'form': form})
return render(request, 'custom_account/OAuth2/register.html', {'form': form})
</syntaxhighlight>
</syntaxhighlight>
<div class="card-body">
<div class="card-body">
<h5 class="card-title d-flex justify-content-between align-items-center">
<h5 class="card-title d-flex justify-content-between align-items-center">
{{ app.name }}<a class="btn btn-outline-primary btn-sm" href="{% url 'custom_account:OAuth_client_edit' app.pk %}">정보 수정</a></h5>
{{ app.name }}
<span>
<a class="btn btn-outline-primary btn-sm" href="{% url 'custom_account:OAuth_client_edit' app.pk %}">정보 수정</a>
<a class="btn btn-outline-danger btn-sm" href="{% url 'custom_account:OAuth_delete_client' app.pk %}"
onclick="return confirm('정말로 삭제하시겠습니까? 되돌릴 수 없습니다.');">삭제</a>
</span>
</h5>
<p><strong>Client ID:</strong> {{ app.client_id }}</p>
<p><strong>Client ID:</strong> {{ app.client_id }}</p>
<p><strong>Client Secret:</strong> {{ app.client_secret }}</p>
<p><strong>Client Secret:</strong> {{ app.client_secret }}</p>