Results 1 to 5 of 5

Thread: Method Security: default expression

  1. #1
    Join Date
    Jan 2011
    Posts
    27

    Default Method Security: default expression

    Is there possibility to set default security expression such as @PreAuthorize("hasRole('ROLE_USER')") for all methods in class or whole project?

  2. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    You should be able to use the annotation at class level (though obviously you can't really use method parameters in that case).

    An annotation only makes sense if you add it to the source, but there are ways of applying security attributes across multiple classes. For example, you can use the protect-pointcut syntax which is provided by the namespace.
    Spring - by Pivotal
    twitter @tekul

  3. #3
    Join Date
    Feb 2008
    Posts
    29

    Default

    does the protect-pointcut syntax supprt spring-el expressions? i am unable to get it to work ...

    HTML Code:
    	<security:global-method-security pre-post-annotations="enabled">
    		<security:protect-pointcut expression="execution(* com.acl.controllers.*Controller.*(..))"
    			access="isFullyAuthenticated()" />
    	</security:global-method-security>
    Code:
    java.lang.IllegalArgumentException: Unsupported configuration attributes: [isFullyAuthenticated()]
    	at org.springframework.security.access.intercept.AbstractSecurityInterceptor.afterPropertiesSet(AbstractSecurityInterceptor.java:153)

  4. #4
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    No, it only supports simple attributes.
    Spring - by Pivotal
    twitter @tekul

  5. #5
    Join Date
    Feb 2008
    Posts
    29

    Default

    I logged a New Feature request:

    https://jira.springframework.org/browse/SEC-1663

    Thanks for replying so quickly!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •