Browse Source

Addd more todos

patch-1
Nico Schottelius 4 years ago
parent
commit
cd75870e42
  1. 30
      README.md
  2. 2
      ungleichotp/otpauth/views.py

30
README.md

@ -59,7 +59,8 @@ them to verify a token of somebody else.
- Use an existing token to connect to the service
- All REST based messages: JSON
### POST: /verify
### POST: /ungleichotp/verify
Request JSON object:
@ -260,7 +261,32 @@ DATABASES = {
}
```
Custom auth
```
from django.contrib.auth.models import User
from rest_framework import authentication
from rest_framework import exceptions
class ExampleAuthentication(authentication.BaseAuthentication):
def authenticate(self, request):
username = request.META.get('X_USERNAME')
if not username:
return None
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
raise exceptions.AuthenticationFailed('No such user')
return (user, None)
```
## TODOs
- [ ] serialize / input request
- [x] serialize / input request
- [ ] Remove hard coded JSON
- [ ] Implement registering of new entries
- [ ] Use Custom authentication (?) - set User
- [ ] Maybe we map name+realm == User (?)

2
ungleichotp/otpauth/views.py

@ -6,7 +6,7 @@ from django.http import HttpResponse, JsonResponse
import json
class VerifyViewSetV1(viewsets.ModelViewSet):
class ModelVerifyViewSet(viewsets.ModelViewSet):
serializer_class = VerifySerializer
def get_queryset(self):

Loading…
Cancel
Save