Addd more todos

This commit is contained in:
Nico Schottelius 2018-11-17 19:00:48 +01:00
parent 6b22532e98
commit cd75870e42
2 changed files with 29 additions and 3 deletions

View file

@ -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 (?)

View file

@ -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):