Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6583547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:25:24+00:00 2026-05-25T16:25:24+00:00

I’m currently integrating springs-security into our new web application stack. We will need to

  • 0

I’m currently integrating springs-security into our new web application stack. We will need to be able to grant permissions for a user or role to access a specific object or all objects of a certain type. However that’s one thing I didn’t really get when working through documentations and examples:

Does an ACL only grant permissions to a user/role for a single object or does it do that for the entire type? As I understand it, domain object means the type but the examples and tutorials seem like they assign permissions to specific objects. Am I just confused or can I do both? If not, how do I do the other?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:25:24+00:00Added an answer on May 25, 2026 at 4:25 pm

    With spring-security you can do both. It’s possible because spring-security supports the so called permission rules – within the spring-security terminology they call it permission evaluators. Permission rules encompass ACL, but also you can secure instances of objects when they’re in a certain state…etc.

    This is how it works:

    1. You need to extend the PermissionEvaluator – this allows you to have super custom logic for determining access rights – you can check the type of the object or check for a particular id, or check if the user invoking the method is the user that created the object, etc.:

      public class SomePermissionsEvaluator implements PermissionEvaluator {
          @Override
          public boolean hasPermission(Authentication authentication, Object targetDomainObject, Object permission) {
              if (permission.equals("do_something") && 
              /*authentication authorities has the role A*/) {
                  return true
              } else if (permission.equals("do_something_else") && 
              /*authentication authorities has the role B*/) {
                  return /*true if targetDomainObject satisfies certain condition*/;
              }
      
              return false;
          }
      
          @Override
          public boolean hasPermission(Authentication authentication,
              Serializable targetId, String targetType, Object permission) {
          throw new UnsupportedOperationException();
          }
      }
      
    2. Now that you have a security rule, you need to apply it through annotations:

      @PreAuthorize("hasRole('SOME_ROLE_OR_RIGHT') and" +
      " hasPermission(#someDomainObject, 'do_something')")
      public void updateSomeDomainObject(SomeDomainObject someDomainObject) {
          // before updating the object spring-security will check the security rules
      }
      
    3. In order for this to work the security annotations should be enabled in the applicationContext.xml:

      <global-method-security secured-annotations="enabled" pre-post-annotations="enabled">
          <expression-handler ref="expressionHandler"/>
      </global-method-security>
      
      <beans:bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
          <beans:property name="permissionEvaluator">
              <beans:bean id="permissionEvaluator" class="com.npacemo.permissions.SomePermissionsEvaluator"/>
          </beans:property>
      </beans:bean>
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I need a function that will clean a strings' special characters. I do NOT
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.