Starcounter/Starcounter.Authorization

Can't use authorization library in two apps simultaneously

Closed this issue · 0 comments

Every time I want to use PermissionSelectionPartial proper GET handler should be registered to expose PermissionSelectionPartial.html. It's done in PermissionSelectionPartial.json.cs by RegisterResources method. Unfortunately registered URI is /Authorization/viewmodels/PermissionSelectionPartial.html. If I run second app, a database throws an error:

Starcounter.DbException: ScErrFailingEntrypoint (SCERR4259): The user code entrypoint method raised an exception. ScErrHandlerAlreadyRegistered (SCERR13003): This handler has already been registered. GET /authorization/viewmodels/permissionselectionpartial.html on port 8080

We can't register the same twice. I see two options: either we register all handlers with som App prefix or in this method we check if it's already there.

cc @joozek78