@@ -108,7 +108,7 @@ Kotlin::
108108open class MyCustomerService {
109109 @PreAuthorize("hasAuthority('permission:read')")
110110 @PostAuthorize("returnObject.owner == authentication.name")
111- fun readCustomer(val id: String): Customer { ... }
111+ fun readCustomer(id: String): Customer { ... }
112112}
113113----
114114======
@@ -338,7 +338,7 @@ Kotlin::
338338@Component
339339open class BankService {
340340 @PreAuthorize("hasRole('ADMIN')")
341- fun readAccount(val id: Long): Account {
341+ fun readAccount(id: Long): Account {
342342 // ... is only invoked if the `Authentication` has the `ROLE_ADMIN` authority
343343 }
344344}
@@ -426,7 +426,7 @@ Kotlin::
426426@Component
427427open class BankService {
428428 @PostAuthorize("returnObject.owner == authentication.name")
429- fun readAccount(val id: Long): Account {
429+ fun readAccount(id: Long): Account {
430430 // ... is only returned if the `Account` belongs to the logged in user
431431 }
432432}
@@ -536,7 +536,7 @@ Kotlin::
536536@Component
537537open class BankService {
538538 @RequireOwnership
539- fun readAccount(val id: Long): Account {
539+ fun readAccount(id: Long): Account {
540540 // ... is only returned if the `Account` belongs to the logged in user
541541 }
542542}
@@ -993,7 +993,7 @@ Kotlin::
993993@Component
994994open class BankService {
995995 @IsAdmin
996- fun readAccount(val id: Long): Account {
996+ fun readAccount(id: Long): Account {
997997 // ... is only returned if the `Account` belongs to the logged in user
998998 }
999999}
@@ -1084,7 +1084,7 @@ Kotlin::
10841084@Component
10851085open class BankService {
10861086 @HasRole("ADMIN")
1087- fun readAccount(val id: Long): Account {
1087+ fun readAccount(id: Long): Account {
10881088 // ... is only returned if the `Account` belongs to the logged in user
10891089 }
10901090}
@@ -1144,7 +1144,7 @@ Kotlin::
11441144@Component
11451145open class BankService {
11461146 @HasAnyRole(roles = arrayOf("'USER'", "'ADMIN'"))
1147- fun readAccount(val id: Long): Account {
1147+ fun readAccount(id: Long): Account {
11481148 // ... is only returned if the `Account` belongs to the logged in user
11491149 }
11501150}
@@ -1271,7 +1271,7 @@ Kotlin::
12711271----
12721272@Component("authz")
12731273open class AuthorizationLogic {
1274- fun decide(val operations: MethodSecurityExpressionOperations): boolean {
1274+ fun decide(operations: MethodSecurityExpressionOperations): boolean {
12751275 // ... authorization logic
12761276 }
12771277}
@@ -1342,7 +1342,7 @@ Kotlin::
13421342----
13431343@Component("authz")
13441344open class AuthorizationLogic {
1345- fun decide(val operations: MethodSecurityExpressionOperations): AuthorizationDecision {
1345+ fun decide(operations: MethodSecurityExpressionOperations): AuthorizationDecision {
13461346 // ... authorization logic
13471347 return MyAuthorizationDecision(false, details)
13481348 }
@@ -1435,13 +1435,13 @@ Kotlin::
14351435class MethodSecurityConfig {
14361436 @Bean
14371437 @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
1438- fun preAuthorize(val manager: MyAuthorizationManager) : Advisor {
1438+ fun preAuthorize(manager: MyAuthorizationManager) : Advisor {
14391439 return AuthorizationManagerBeforeMethodInterceptor.preAuthorize(manager)
14401440 }
14411441
14421442 @Bean
14431443 @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
1444- fun postAuthorize(val manager: MyAuthorizationManager) : Advisor {
1444+ fun postAuthorize(manager: MyAuthorizationManager) : Advisor {
14451445 return AuthorizationManagerAfterMethodInterceptor.postAuthorize(manager)
14461446 }
14471447}
@@ -1501,7 +1501,7 @@ Kotlin::
15011501----
15021502companion object {
15031503 @Bean
1504- fun methodSecurityExpressionHandler(val roleHierarchy: RoleHierarchy) : MethodSecurityExpressionHandler {
1504+ fun methodSecurityExpressionHandler(roleHierarchy: RoleHierarchy) : MethodSecurityExpressionHandler {
15051505 val handler = DefaultMethodSecurityExpressionHandler()
15061506 handler.setRoleHierarchy(roleHierarchy)
15071507 return handler
@@ -3236,7 +3236,7 @@ Kotlin::
32363236[source,kotlin,role="secondary"]
32373237----
32383238class MyAuthorizer {
3239- fun isAdmin(val root: MethodSecurityExpressionOperations): boolean {
3239+ fun isAdmin(root: MethodSecurityExpressionOperations): boolean {
32403240 val decision = root.hasAuthority("ADMIN");
32413241 // custom work ...
32423242 return decision;
@@ -3295,7 +3295,7 @@ Kotlin::
32953295----
32963296@Component
32973297class MyExpressionHandler: DefaultMethodSecurityExpressionHandler {
3298- override fun createEvaluationContext(val authentication: Supplier<Authentication>,
3298+ override fun createEvaluationContext(authentication: Supplier<Authentication>,
32993299 val mi: MethodInvocation): EvaluationContext {
33003300 val context = super.createEvaluationContext(authentication, mi) as StandardEvaluationContext
33013301 val delegate = context.getRootObject().getValue() as MethodSecurityExpressionOperations
0 commit comments