Spring: which parser should be used to parse security expressions

I would like to analyze standard safety expressions such as hasRoleetc. to get their value in a variable (in JSP). How can i do this? SpelExpressionParseris the standard EL parser, but I don’t think it will parse the security expression.

0
source share
2 answers

The easiest approach is to use a tag <sec:authorize>and change the desired variable inside your body.

If you really want to evaluate the expressions manually, look at the source AuthorizeTag- it will get the first bean of the type WebSecurtyExpressionHandlerfrom the context of the web application and use it to get ExpressionParserand EvaluationContext.

+1

spring . , .

0

All Articles