Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication & Initial "/user/me" implementation #100

Merged
merged 11 commits into from
Apr 16, 2024

Conversation

henrybrink
Copy link
Collaborator

This PR adds authentication with the example user via Basic Auth, using the passport module.
This is implemented for early testing. When using this module, all protected endpoints must be called with valid credentials, otherwise the server will respond with 401.

The currently logged in user will be available via "req.user" in the respective controllers.

This closes #94.

@henrybrink henrybrink added the backend Issues related to the backend label Apr 15, 2024
@benedictweis
Copy link
Contributor

#96 😉

@benedictweis
Copy link
Contributor

Es scheint ein file nicht korrekt formatiert zu sein, siehe backend Job.

@henrybrink
Copy link
Collaborator Author

Es scheint ein file nicht korrekt formatiert zu sein, siehe backend Job.

Nein, die e2e tests die eingerichtet wurden sind nur einfach falsch eingerichtet und funktionieren nicht mit der Datenbank. Es ist alles korrekt formatiert.

@henrybrink
Copy link
Collaborator Author

@benedictweis Da nur die e2e-Tests nicht ausgeführt weerden können (sonst aber alles geht) würde ich vorschlagen den gefailten Test zu ignorieren, da die Environment-Konfiguration bisher noch nicht im Main ist - das können wir dann ja in einer separaten PR machen.

@benedictweis
Copy link
Contributor

@benedictweis Da nur die e2e-Tests nicht ausgeführt weerden können (sonst aber alles geht) würde ich vorschlagen den gefailten Test zu ignorieren, da die Environment-Konfiguration bisher noch nicht im Main ist - das können wir dann ja in einer separaten PR machen.

Alles klar, machen wir so

@benedictweis
Copy link
Contributor

Ich schau den PR später durch

Copy link
Contributor

@benedictweis benedictweis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sehr guter PR 👏, sehr lesbarer Code und gut strukturierte Tests. Well done 👍

backend/src/api/user/user.controller.spec.ts Outdated Show resolved Hide resolved
backend/src/api/user/user.controller.ts Outdated Show resolved Hide resolved
backend/src/auth/auth.service.ts Outdated Show resolved Hide resolved
backend/src/auth/auth.service.ts Outdated Show resolved Hide resolved
backend/src/db/repositories/user.repository.ts Outdated Show resolved Hide resolved
Co-authored-by: Benedict Weis <[email protected]>
@benedictweis benedictweis merged commit caf4732 into main Apr 16, 2024
0 of 2 checks passed
@benedictweis benedictweis deleted the dev/backend/authentication-configuration branch June 19, 2024 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Issues related to the backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Authentifizierung (mittels Passport)
2 participants