-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Open
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triagedtype: enhancementA general enhancementA general enhancement
Description
Expected Behavior
In a similar fashion to the added hasScope
for authorization rules (added with #13754), I would like to use hasScope(scope)
in SpEL expressions in @PreAuthorize
, i.e.:
@PreAuthorize("hasScope('read'")
Current Behavior
This can already be achieved using hasAuthority
:
@PreAuthorize("hasAuthority('SCOPE_read'")
Evidently, not a big issue. But I'd like to add that hasRole
also exists:
private String defaultRolePrefix = "ROLE_";
@Override
public final boolean hasAnyRole(String... roles) {
return hasAnyAuthorityName(this.defaultRolePrefix, roles);
}
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triagedtype: enhancementA general enhancementA general enhancement