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

Method Security SpEL supports throwing AccessDeniedException #14600

Closed
Tracked by #14595
rwinch opened this issue Feb 13, 2024 · 0 comments · Fixed by #14882
Closed
Tracked by #14595

Method Security SpEL supports throwing AccessDeniedException #14600

rwinch opened this issue Feb 13, 2024 · 0 comments · Fixed by #14882
Assignees
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement

Comments

@rwinch
Copy link
Member

rwinch commented Feb 13, 2024

It would be nice if we supported throwing AccessDeniedException for Method Security SpEL. This would allow method security to easily convey more information to the framework on why authorization failed (e.g. requires MFA). They can also use AuthorizationManager instances in their SpEL. For example:

@Service
class Authz {
  AuthorizationDecision check(...) {
    throw new AccessDeniedException("Denied");
  }
}
@PreAuthorize("@authz.check(...)")
@jzheaux jzheaux self-assigned this Apr 2, 2024
@jzheaux jzheaux added in: core An issue in spring-security-core type: enhancement A general enhancement labels Apr 2, 2024
jzheaux added a commit to jzheaux/spring-security that referenced this issue Apr 4, 2024
jzheaux added a commit to jzheaux/spring-security that referenced this issue Apr 4, 2024
jzheaux added a commit to jzheaux/spring-security that referenced this issue Apr 10, 2024
jzheaux added a commit to jzheaux/spring-security that referenced this issue Apr 10, 2024
jzheaux added a commit to jzheaux/spring-security that referenced this issue Apr 10, 2024
jzheaux added a commit that referenced this issue Apr 10, 2024
jzheaux added a commit that referenced this issue Apr 11, 2024
@jzheaux jzheaux moved this to Done in Spring Security Team May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants