Skip to content

Commit 62d77ec

Browse files
committed
Add GrantedAuthorityDefaults to Expression Handler
Issue gh-9289
1 parent 68cf744 commit 62d77ec

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityConfiguration.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ AuthorizationMethodInterceptor authorizationMethodInterceptor() {
107107

108108
private MethodSecurityExpressionHandler getMethodSecurityExpressionHandler() {
109109
if (this.methodSecurityExpressionHandler == null) {
110-
this.methodSecurityExpressionHandler = new DefaultMethodSecurityExpressionHandler();
110+
DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler = new DefaultMethodSecurityExpressionHandler();
111+
if (this.grantedAuthorityDefaults != null) {
112+
methodSecurityExpressionHandler.setDefaultRolePrefix(this.grantedAuthorityDefaults.getRolePrefix());
113+
}
114+
this.methodSecurityExpressionHandler = methodSecurityExpressionHandler;
111115
}
112116
return this.methodSecurityExpressionHandler;
113117
}

0 commit comments

Comments
 (0)