When you configure the project setting Api Settings -> Default API Security -> Secured by default, then any roles defined in the Services designer, on the Secured stereotype are not applied.
This is very easy to reproduce.
Set Api Settings -> Default API Security to Unsecured by default
Create/expose an endpoint
Apply stereotype "Secured"
Set value to "Admin"
Run software factory
This will add an [Authorize(Roles = "Admin")] to the controller action.
Change the project setting from Unsecured by default to Secured by default.
Run the software factory.
This will now REMOVE[Authorize(Roles = "Admin")] from the controller action, and add [Authorize] to the controller class.
The expected behaviour here, with Secured by default, is that the class gets the [Authorize] attribute AND the controller action gets a [Authorize(Roles = "Admin")], if required.
Even better, is that Secured by default actually applies requiring authorization at the middleware layer
Thanks for logging this, we have added this as a bug on our backlog and will be looking at it as soon as we are able. We will keep this issue open and update it when a fix is available.
What happened?
When you configure the project setting
Api Settings
->Default API Security
->Secured by default
, then any roles defined in theServices
designer, on theSecured stereotype
are not applied.This is very easy to reproduce.
Api Settings
->Default API Security
toUnsecured by default
[Authorize(Roles = "Admin")]
to the controller action.Unsecured by default
toSecured by default
.[Authorize(Roles = "Admin")]
from the controller action, and add[Authorize]
to the controller class.The expected behaviour here, with
Secured by default
, is that the class gets the[Authorize]
attribute AND the controller action gets a[Authorize(Roles = "Admin")]
, if required.Even better, is that
Secured by default
actually applies requiring authorization at the middleware layere.g.
becomes
What version of Intent Architect are you using?
4.0.6
Additional information
No response