Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default API Security does not work like it should #67

Open
shainegordon opened this issue Oct 23, 2023 · 1 comment
Open

Default API Security does not work like it should #67

shainegordon opened this issue Oct 23, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@shainegordon
Copy link

shainegordon commented Oct 23, 2023

What happened?

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.

  1. Set Api Settings -> Default API Security to Unsecured by default
  2. Create/expose an endpoint
  3. Apply stereotype "Secured"
  4. Set value to "Admin"
  5. Run software factory
  6. This will add an [Authorize(Roles = "Admin")] to the controller action.
  7. Change the project setting from Unsecured by default to Secured by default.
  8. Run the software factory.
  9. 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

e.g.

app.UseEndpoints(endpoints =>
{
       endpoints.MapDefaultHealthChecks();
       endpoints.MapControllers();
});

becomes

app.UseEndpoints(endpoints =>
{
       endpoints.MapDefaultHealthChecks();
       endpoints.MapControllers().RequireAuthorization();
});

What version of Intent Architect are you using?

4.0.6

Additional information

No response

@shainegordon shainegordon added the bug Something isn't working label Oct 23, 2023
@JonathanLydall JonathanLydall self-assigned this Oct 23, 2023
@JonathanLydall
Copy link
Member

Hi @shainegordon,

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants