Update readme, auth ideas

This commit is contained in:
Nico Schottelius 2018-11-17 21:45:53 +01:00
parent cd75870e42
commit cdb45bd1f0
3 changed files with 31 additions and 2 deletions

View file

@ -283,10 +283,23 @@ class ExampleAuthentication(authentication.BaseAuthentication):
```
Custom user
Dont forget to point AUTH_USER_MODEL to it. Do this before creating any migrations or running manage.py migrate for the first time.
## TODOs
- [x] serialize / input request
- [ ] Remove hard coded JSON
- [ ] Implement registering of new entries
- [ ] Use Custom authentication (?) - set User
- [ ] Use Custom authentication (?) - needs to have a user
- [ ] Maybe we map name+realm == User (?)
- name == name@realm
- no password
- seed
- custom auth method
- [ ] Implement creating new "User"
- by POST / Model based
- [ ] Implement deleting "User"

View file

@ -1,4 +1,5 @@
from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class OTPSeed(models.Model):
@ -12,3 +13,17 @@ class OTPSeed(models.Model):
def __str__(self):
return "'{}'@{}".format(self.name, self.realm)
# class OTPUser(AbstractUser, OTPSeed):
# @classmethod
# def get_username(cls):
# pass
# @classmethod
# def check_password(cls, raw_password):
# """ receives a time based token"""
# pass
# @classmethod
# def has_usable_password(cls):
# pass

View file

@ -21,11 +21,12 @@ from django.conf.urls import url, include
from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
from otpauth.models import OTPSeed
from otpauth.views import VerifyViewSet
from otpauth.views import ModelVerifyViewSet, VerifyViewSet
router = routers.DefaultRouter()
router.register(r'ungleichotp', VerifyViewSet, basename='ungleichotp')
router.register(r'ungleichotpv2', ModelVerifyViewSet, basename='ungleichotpv2')
print(router.urls)