Addd more todos
This commit is contained in:
parent
6b22532e98
commit
cd75870e42
2 changed files with 29 additions and 3 deletions
30
README.md
30
README.md
|
@ -59,7 +59,8 @@ them to verify a token of somebody else.
|
||||||
- Use an existing token to connect to the service
|
- Use an existing token to connect to the service
|
||||||
- All REST based messages: JSON
|
- All REST based messages: JSON
|
||||||
|
|
||||||
### POST: /verify
|
|
||||||
|
### POST: /ungleichotp/verify
|
||||||
|
|
||||||
Request JSON object:
|
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
|
## TODOs
|
||||||
|
|
||||||
- [ ] serialize / input request
|
- [x] serialize / input request
|
||||||
- [ ] Remove hard coded JSON
|
- [ ] Remove hard coded JSON
|
||||||
|
- [ ] Implement registering of new entries
|
||||||
|
- [ ] Use Custom authentication (?) - set User
|
||||||
|
- [ ] Maybe we map name+realm == User (?)
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.http import HttpResponse, JsonResponse
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class VerifyViewSetV1(viewsets.ModelViewSet):
|
class ModelVerifyViewSet(viewsets.ModelViewSet):
|
||||||
serializer_class = VerifySerializer
|
serializer_class = VerifySerializer
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue