Philip Molares
8d815cf2c5
config: Fix inconsistent env vars
...
This should make the translation from env var name to config name and vice versa more consistent.
Fixes #751
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-28 23:28:16 +01:00
David Mehren
1883db4c93
Swagger: Split public and private API
...
Fixes #759
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 23:11:56 +01:00
Renovate Bot
ca066f4228
fix(deps): update nestjs packages to v7.6.7
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-27 17:26:10 +00:00
Philip Molares
62a5215242
auth: Encode secret in base64url
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-26 10:19:12 +01:00
Philip Molares
1791cb7c82
auth: Fix base64url transformation
...
The problem was that replace only replaces the first occurrence of a string and not all as is needed for this function.
tsconfig.json needed lib to be set to esnext or the replaceAll function won't be available…
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-26 10:18:52 +01:00
Renovate Bot
06768e33f5
Update dependency mkdocs-material to v6.2.6
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-27 17:23:14 +00:00
Renovate Bot
ce71581661
Update dependency pymdown-extensions to v8.1.1
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-26 01:46:17 +00:00
David Mehren
af35cd1bb2
HistoryEntryDto: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:45:52 +01:00
David Mehren
c38019b0f2
HistoryEntryUpdateDto: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:45:43 +01:00
David Mehren
6a21665c3e
NoteDto: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:45:34 +01:00
David Mehren
7688b7c21f
NoteAuthorshipDto: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:44:47 +01:00
David Mehren
6c7bd0ed26
RevisionMetadataDto: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:44:20 +01:00
David Mehren
09cf25d111
RevisionDto: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:44:11 +01:00
David Mehren
3233b5c958
NoteMetadata DTOs: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:23:09 +01:00
David Mehren
eb2544bc2b
NotePermission DTOs: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:22:52 +01:00
David Mehren
1a825ed199
UserInfoDto: Add doc comments
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:22:01 +01:00
David Mehren
9a77cd5565
Swagger: Enable comment parsing
...
Signed-off-by: David Mehren <git@herrmehren.de>
2021-01-25 22:20:54 +01:00
Renovate Bot
e643d59fc2
chore(deps): update dependency supertest to v6.1.3
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-25 22:02:40 +00:00
Renovate Bot
671aa005f5
fix(deps): pin dependencies
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-25 21:52:35 +00:00
Philip Molares
141e16c2b9
regenerated yarn.lock
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-25 21:32:17 +01:00
Philip Molares
c8da989f25
auth: Run removeInvalidTokens 5s after startup
...
This should prevent problem with the AuthToken purge on Sundays, as the service is either running on sunday or will be restarted there after.
Also move base64url comment to right function
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-25 16:29:09 +01:00
Philip Molares
ad0ab648bc
auth: Add maximum token lifetime of 2 years.
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-25 12:14:26 +01:00
Philip Molares
6686fa58c5
auth: Run removeInvalidTokens 5s after startup
...
This should prevent problem with the AuthToken purge on Sundays, as the service is either running on sunday or will be restarted there after.
Also move base64url comment to right function
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-25 18:16:08 +01:00
Philip Molares
af993407b3
auth: Add token limit of 200
...
This is a very high ceiling unlikely to hinder legitimate usage, but should prevent possible attack vectors
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-25 12:05:25 +01:00
Philip Molares
39d9fb5dec
tokens: Add token creation
...
Fix token deletion
Update plantuml docs
Add token validUntil and lastUsed fields
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-21 19:37:43 +01:00
Philip Molares
b84d0f7cab
auth: fixes unit and e2e tests
...
adds MockAuthGuard which always return user 'hardcoded'
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-16 19:33:09 +01:00
Philip Molares
d0c5d64627
auth: adds token-auth to public api
...
adds auth service
adds auth module
adds token-auth strategy
adds token-auth to all public api calls
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-15 18:53:09 +01:00
Philip Molares
8f008c7cc5
auth: Add cron to clean old tokens
...
Rename AuthToken.identifier to label
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-24 20:37:04 +01:00
Philip Molares
14a4872f49
auth: Remove userName parameter of removeToken function
...
As suggested by @innaytool
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-23 22:24:59 +01:00
Philip Molares
a8b46923fd
auth: Integrate suggestions by @davidmehren
...
Add number type alias TimestampMillis
Remove solved ToDos
Change AuthToken and AuthTokenDto to use Date
Rename authService unit tests
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-23 21:24:11 +01:00
Philip Molares
e6dc8c7678
auth: Split randomBase64UrlString in two functions
...
add test for BufferToBase64Url and toAuthTokenDto
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-23 19:04:00 +01:00
Philip Molares
508ad26771
auth: Add tests for AuthService
...
Move AuthTokens to auth folder
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-22 15:29:10 +01:00
Philip Molares
c9751404f7
tokens: Add token creation
...
Fix token deletion
Update plantuml docs
Add token validUntil and lastUsed fields
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-21 19:37:43 +01:00
Philip Molares
cce1626c48
auth: fixes unit and e2e tests
...
adds MockAuthGuard which always return user 'hardcoded'
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-16 19:33:09 +01:00
Philip Molares
33d9c455b8
openapi: adds auth to all public api routes
...
See:
https://docs.nestjs.com/openapi/security
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-16 17:45:14 +01:00
Philip Molares
2ab950c5c3
auth: adds token-auth to public api
...
adds auth service
adds auth module
adds token-auth strategy
adds token-auth to all public api calls
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-15 18:53:09 +01:00
Philip Molares
4784a1aea2
private: Add until to token creation
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-21 12:33:45 +01:00
Philip Molares
324ba71d24
private: removes collision check for tokens
...
this seems very unnecessary as the chance of this is 1 / 2^512
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-17 20:35:43 +01:00
Philip Molares
97f7128355
private: fixed token generation bugs
...
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-17 19:52:08 +01:00
Philip Molares
c232707a89
db-schema: updates plantuml
...
adds identifier and createdAt to AuthToken
renames authToken in User to authTokens
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-17 14:49:28 +01:00
Philip Molares
822c01f2c7
private: save token hashed
...
Auth tokens are now saved in hashed form.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-17 14:45:16 +01:00
Philip Molares
e5545043be
auth: hash auth token
...
Since the auth token will be stored in hashed form in the db, we need to hash each provided auth token in order to search in the db for them.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-17 14:38:05 +01:00
Philip Molares
667cf7e915
auth: add hash function
...
the hash function uses bcrypt with 2^16 iterations.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-17 14:32:17 +01:00
Philip Molares
b589dedd2a
private: adds tokens controller
...
adds private api
adds AuthTokenDto and AuthTokenWithSecretDto
adds necessary methods in the users service
adds RandomnessError
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-16 23:53:46 +01:00
Philip Molares
e04fcb9ee9
auth: hash auth token
...
Since the auth token will be stored in hashed form in the db, we need to hash each provided auth token in order to search in the db for them.
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-17 15:27:13 +01:00
Philip Molares
80c7ae2fa9
private: adds tokens controller
...
adds private api
adds AuthTokenDto and AuthTokenWithSecretDto
adds necessary methods in the users service
adds RandomnessError
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-01-16 23:53:46 +01:00
Renovate Bot
1c7452d066
chore(deps): lock file maintenance
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-25 20:21:20 +00:00
Renovate Bot
bd6c7ee7c0
chore(deps): update linters to v4.14.1
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-25 19:38:27 +00:00
Renovate Bot
b52f50e390
chore(deps): update dependency supertest to v6.1.2
...
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-01-25 06:43:08 +00:00
Yannick Bungers
5246f0c05d
Removed special table name in Note object
...
and changed table names in plantuml file
Signed-off-by: Yannick Bungers <git@innay.de>
2021-01-23 00:41:49 +01:00