Skip to content

Commit

Permalink
Add support AuthorizationResult for AuthorizationManager
Browse files Browse the repository at this point in the history
Added a new authorization method to AuthorizationManager that returns AuthorizationResult.

Closes spring-projectsgh-14843
  • Loading branch information
Max Batischev authored and Max Batischev committed Apr 7, 2024
1 parent 79e410c commit 8b274c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -92,7 +92,7 @@ public AuthorizationResult authorize(Supplier<Authentication> authentication, Me
MethodSecurityExpressionHandler expressionHandler = this.registry.getExpressionHandler();
EvaluationContext ctx = expressionHandler.createEvaluationContext(authentication, mi.getMethodInvocation());
expressionHandler.setReturnObject(mi.getResult(), ctx);
return (AuthorizationDecision) ExpressionUtils.evaluate(attribute.getExpression(), ctx);
return ExpressionUtils.evaluate(attribute.getExpression(), ctx);
}

@Override
Expand Down
Expand Up @@ -82,7 +82,7 @@ public AuthorizationResult authorize(Supplier<Authentication> authentication, Me
return null;
}
EvaluationContext ctx = this.registry.getExpressionHandler().createEvaluationContext(authentication, mi);
return (AuthorizationDecision) ExpressionUtils.evaluate(attribute.getExpression(), ctx);
return ExpressionUtils.evaluate(attribute.getExpression(), ctx);
}

@Override
Expand Down

0 comments on commit 8b274c1

Please sign in to comment.