I have a User
entity, which may have a RefreshToken
(for authentication).
Notes:
- A refresh token doesn't have "identity", but is related to a single user - it is only valid for that user. In the db that means a foreign key to users table. In Entity Framework I can however model it as an "owned" type so that it's part of the users table.
- A refresh token can be revoked, i.e. deleted from the database
- A refresh token can be renewed - at the domain level that means replacing the old with a new one, but at the db level that means simply updating the existing record (unless it's an "owned" type in which case I'll update the user record)
So, is the RefreshToken
an entity or a value object?