Initial commit with inital CMS
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
# Invitation Design — Unit 02: Identity & RBAC
|
||||
|
||||
Dit document beschrijft de technische implementatie van het uitnodigingssysteem.
|
||||
|
||||
## 1. IInvitationService
|
||||
|
||||
```csharp
|
||||
public interface IInvitationService
|
||||
{
|
||||
Task<string> CreateInvitationAsync(string email, string role);
|
||||
Task<bool> ValidateInvitationAsync(string token);
|
||||
Task CompleteInvitationAsync(string token, string password);
|
||||
}
|
||||
```
|
||||
|
||||
## 2. Token Generatie
|
||||
|
||||
Het `InvitationToken` wordt gegenereerd met de `RandomNumberGenerator`:
|
||||
|
||||
```csharp
|
||||
public string GenerateSecureToken()
|
||||
{
|
||||
var bytes = new byte[32];
|
||||
RandomNumberGenerator.Fill(bytes);
|
||||
return Convert.ToBase64String(bytes);
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Workflow Details
|
||||
|
||||
1. **Creatie**:
|
||||
- Een `Invitation` record wordt aangemaakt in de database.
|
||||
- Het `Token` wordt gehasht opgeslagen (net als een wachtwoord) om misbruik bij database-lekken te voorkomen.
|
||||
2. **Validatie**:
|
||||
- Het systeem zoekt het record op basis van de token-string.
|
||||
- Controleert `ExpiryDate` en `IsAccepted`.
|
||||
3. **Afronding**:
|
||||
- Bij `CompleteInvitationAsync` wordt de `ApplicationUser` aangemaakt via de `UserManager`.
|
||||
- De rol wordt toegekend.
|
||||
- Het uitnodigingsrecord wordt gemarkeerd als `IsAccepted = true`.
|
||||
Reference in New Issue
Block a user