Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Spring Security 3 supports <code>@PreAuthorize</code> annotation that allows you to express authorization logic in <a href="http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch07.html" rel="nofollow">Spring Expression Language</a>, like this:</p> <pre><code>public class BusinessService { @PreAuthorize("hasRole('ADMINISTRATOR') or " + "(#o.status != 'someStatus' and hasRole('USER') and #o.ownerName == principal.name)") public void updateBusinessObject(BusinessObject o) { ... } } </code></pre> <p>And you need <code>&lt;security:global-method-security pre-post-annotations="enabled"/&gt;</code> to apply security aspect.</p> <p>If the expression is too complex to represent in Spring Expression Language, you can move some logic to Java code by adding custom variables into expression's <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/expression/EvaluationContext.html" rel="nofollow"><code>EvaluationContext</code></a> (by customizing <a href="http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/access/expression/method/MethodSecurityExpressionHandler.html" rel="nofollow"><code>MethodSecurityExpressionHandler</code></a>).</p> <p>Note, however, that you need to have your code compiled in debug mode in order to use method arguments in the expression.</p> <p><strong>See also:</strong></p> <ul> <li><a href="http://static.springsource.org/spring-security/site/docs/3.0.x/reference/el-access.html#el-pre-post-annotations" rel="nofollow">15.3.1 @Pre and @Post Annotations</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload