Add Authentication/Authorisation #13
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Investigation
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Backstube/bookkeeping#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It is required that users can authenticate with the app to know who is trying to access it to show the according data. Furthermore, authorisation is also required to ensure users can only access what they are allowed to access.
Authentication can be done using the Authentication middleware of asp.net.
Authorisation should be a custom implementation as the asp.net provided one doesn't seem right for this use-case.
A new
UserServiceshould be implemented. It receives the authenticated user via aClaimsPrincipaland maps it to a WBS user. It provides a way to access the user but also a way to check if the currently authenticated user is authorised to do an action. A method of the formHasRight(params Data.Entities.Right[])is probably the way to go.Also look into creating a custom
AuthorizeAttributeso that we don't have to always inject the UserService to ensure the user is authorised to perform an action. Maybe this can even be combined with PipelineBehaviours from MediatRWe want to use Keycloak for authentication and authorisation. Here is a tutorial on how to setup and use Keycloak.
Here is a more modern blog/tutorial from 2026.
The only thing to ensure is, that can easily add new rights or groups/roles as having everything hard coded seems a bit wrong.