Require authentication on all rest endpoints
This commit is contained in:
parent
9dc6e02029
commit
b16d484406
2 changed files with 18 additions and 6 deletions
13
README.md
13
README.md
|
@ -190,12 +190,17 @@ Don’t forget to point AUTH_USER_MODEL to it. Do this before creating any migra
|
||||||
- password is used for admin login (?)
|
- password is used for admin login (?)
|
||||||
- seed
|
- seed
|
||||||
- custom auth method
|
- custom auth method
|
||||||
- [ ] try to fake username for django based on name+realm (?)
|
- [n] try to fake username for django based on name+realm (?)
|
||||||
- [ ] maybe overwrite get_username() (?)
|
- [n] maybe overwrite get_username() (?)
|
||||||
- [ ] Use Custom authentication (?) - needs to have a user
|
- [x] Use Custom authentication - needs to have a user!
|
||||||
- [ ] Implement creating new "User"
|
- [x] Implement creating new "User"
|
||||||
- by POST / Model based
|
- by POST / Model based
|
||||||
|
- [ ] Add tests for verify
|
||||||
|
- [ ] Add tests for authentication
|
||||||
|
- [ ] Add proper documentation
|
||||||
- [ ] move totp constants into settings
|
- [ ] move totp constants into settings
|
||||||
- [ ] move field lengths into settings
|
- [ ] move field lengths into settings
|
||||||
- [ ] make settings adjustable by environment (?)
|
- [ ] make settings adjustable by environment (?)
|
||||||
- [ ] Remove hard coded JSON (?)
|
- [ ] Remove hard coded JSON (?)
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
|
@ -102,14 +102,23 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Customer user model so that we can use our tokens for authentication!
|
||||||
|
AUTH_USER_MODEL = 'otpauth.OTPSeed'
|
||||||
|
|
||||||
|
# Custom authentication so we can use tokens ourselves
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
'rest_framework.authentication.SessionAuthentication',
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
'otpauth.models.OTPAuthentication'
|
'otpauth.models.OTPAuthentication'
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticated',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/2.1/topics/i18n/
|
# https://docs.djangoproject.com/en/2.1/topics/i18n/
|
||||||
|
|
||||||
|
@ -128,5 +137,3 @@ USE_TZ = True
|
||||||
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
AUTH_USER_MODEL = 'otpauth.OTPSeed'
|
|
||||||
|
|
Loading…
Reference in a new issue