pdevito3 / craftsman

A .NET scaffolding tool to help you stop worrying about boilerplate and focus on your business logic 🚀
https://wrapt.dev
MIT License
1.12k stars 65 forks source link

Generated User classes have duplicate identifiers #113

Closed NoTuxNoBux closed 1 year ago

NoTuxNoBux commented 1 year ago

It's a minor bug, but the generated User classes have their own identifier generated whilst they already inherit from BaseEntity, which also provides an ID:

    [Sieve(CanFilter = true, CanSort = true)]
    public string Identifier { get; private set; }

This means there are two GUIDs in the database for each User.

Related to this, the generated PUT and POST calls expect an ID to be passed in the data, which is a bit awkward since PUT already expects the ID as parameter and the identifier is usually not a field that clients should be able to update.

Steps to reproduce

  1. Configure authentication through the Wrapt YAML.
  2. Generate a new domain based on the YAML file through Wrapt.

Further technical details

Craftsman version (dotnet tool list -g): 0.20.0

NoTuxNoBux commented 1 year ago

Hmmm, I just realized that, since Wrapt doesn't generate the actual authentication implementation itself, is this perhaps intended to be the remote identifier on the identity provider rather than the local ID?

pdevito3 commented 1 year ago

Yeah this is the IDP identifier. Check out how the keycloak portion integrates (ef use policy handler adds a user of non exists) and you'll see.

Going to close this