Update readme, auth ideas
This commit is contained in:
parent
cd75870e42
commit
cdb45bd1f0
3 changed files with 31 additions and 2 deletions
15
README.md
15
README.md
|
@ -283,10 +283,23 @@ class ExampleAuthentication(authentication.BaseAuthentication):
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Custom user
|
||||||
|
|
||||||
|
Don’t forget to point AUTH_USER_MODEL to it. Do this before creating any migrations or running manage.py migrate for the first time.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
- [x] serialize / input request
|
- [x] serialize / input request
|
||||||
- [ ] Remove hard coded JSON
|
- [ ] Remove hard coded JSON
|
||||||
- [ ] Implement registering of new entries
|
- [ ] Implement registering of new entries
|
||||||
- [ ] Use Custom authentication (?) - set User
|
- [ ] Use Custom authentication (?) - needs to have a user
|
||||||
- [ ] Maybe we map name+realm == 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"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import AbstractUser
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class OTPSeed(models.Model):
|
class OTPSeed(models.Model):
|
||||||
|
@ -12,3 +13,17 @@ class OTPSeed(models.Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "'{}'@{}".format(self.name, self.realm)
|
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
|
||||||
|
|
|
@ -21,11 +21,12 @@ from django.conf.urls import url, include
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from rest_framework import routers, serializers, viewsets
|
from rest_framework import routers, serializers, viewsets
|
||||||
from otpauth.models import OTPSeed
|
from otpauth.models import OTPSeed
|
||||||
from otpauth.views import VerifyViewSet
|
from otpauth.views import ModelVerifyViewSet, VerifyViewSet
|
||||||
|
|
||||||
|
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
router.register(r'ungleichotp', VerifyViewSet, basename='ungleichotp')
|
router.register(r'ungleichotp', VerifyViewSet, basename='ungleichotp')
|
||||||
|
router.register(r'ungleichotpv2', ModelVerifyViewSet, basename='ungleichotpv2')
|
||||||
|
|
||||||
print(router.urls)
|
print(router.urls)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue