0

How to securing methods with spring and MVVM pattern?

asked 2012-06-24 08:30:53 +0800

erciarez gravatar image erciarez
12

Hi,
I am working with ZK 6.0.1, I am using MVVM pattern and I am using spring security
I have a view model

public class TestViewModel{
		@Init
		public void Init(){
			String idStr = (String) Executions.getCurrent().getArg().get("id");
			Long id = StringUtils.isNotEmpty(idStr) ? Long.valueOf(idStr) : null;
			initialize(id);
		}
		public void initialize(Long id){
			//It retrieves object from bbdd
		}
	}


Now, I want securize my application and I want use spring security.
In applicationContext.xml I have added
<sec:global-method-security authentication-manager-ref="authenticationManager" pre-post-annotations="enabled"  proxy-target-class="true">
		<sec:expression-handler ref="expressionHandler"/>
	</sec:global-method-security>


And I have modified TestViewModel
@PreAuthorize("hasRole('ROLE_USER')")
        @Init
	public void Init(){
		String idStr = (String) Executions.getCurrent().getArg().get("id");
		Long id = StringUtils.isNotEmpty(idStr) ? Long.valueOf(idStr) : null;
		initialize(id);
	}   



With this change the method Init is never invoked. What is the problem? How can I securize methods?

Thanks in advance.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-10-18 21:10:35 +0800

stream gravatar image stream
81 3

Erciarez, did you find solution for the issue? I also cannot get it work.

link publish delete flag offensive edit

answered 2012-12-06 15:28:41 +0800

johnspart gravatar image johnspart
3

you get around this problem?

I'm working on something and soon he begins to implement Spring Security

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-06-24 08:30:53 +0800

Seen: 210 times

Last updated: Dec 06 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More