Integrate Spring Security with ZK"

From Documentation
Line 21: Line 21:
 
This demo application is a simple article publish and edit system which allows three kinds of user to access: user with role ''ROLE_USER'', user with role ''ROLE_EDITOR'' and the anonymous user with default reserved role ''IS_AUTHENTICATED_ANONYMOUSLY''.
 
This demo application is a simple article publish and edit system which allows three kinds of user to access: user with role ''ROLE_USER'', user with role ''ROLE_EDITOR'' and the anonymous user with default reserved role ''IS_AUTHENTICATED_ANONYMOUSLY''.
  
Anonymous user can visit the homepage which contains article list, and they can visit the content by clicking article link.
+
* Anonymous user can visit the homepage which contains article list, and they can visit the content by clicking article link.
User with role ''ROLE_USER'' is allowed to post new article and edit their own articles.
+
* User with role ''ROLE_USER'' is allowed to post new article and edit their own articles.
User with role ''ROLE_EDITOR'' is most powerful user who is able to edit and delete any article.
+
* User with role ''ROLE_EDITOR'' is most powerful user who is able to edit and delete any article.
  
 
This article will based on the implementation requirements of this application to demonstrate the integration of Spring Security and ZK.
 
This article will based on the implementation requirements of this application to demonstrate the integration of Spring Security and ZK.

Revision as of 05:49, 26 February 2013

DocumentationSmall Talks2013MarchIntegrate Spring Security with ZK
Integrate Spring Security with ZK

Author
Ian Tsai, Engineer, Potix Corporation
Date
March 04, 2013
Version
ZK 6.5.X, Spring Security 3.1.2

Under Construction-100x100.png This paragraph is under construction.

Introduction

Spring Security is a common solution for developer to serve security needs in a Java web application, it is widely used and is a proven technology. However, due to its nature to protect resources by pattern matching through URL, it's not that obvious for application developer to delegate Spring Security with general amount of ajax frameworks which use Json format in form to structure meta-information.

So in this article, I'll introduce how to integrate Spring Security with ZK seamlessly by going through the construction of a simple demo application(An article publish and editing system).

Resources to Download

I use Git as my source control and has stored my code at Github, you can check out the demo project from here.

If you are more comfortable to war format, you can get the archived project here.

The project is based on Maven, if you want to try different version of ZK or Spring, please change the version number in pom.xml

Demo Application Details

This demo application is a simple article publish and edit system which allows three kinds of user to access: user with role ROLE_USER, user with role ROLE_EDITOR and the anonymous user with default reserved role IS_AUTHENTICATED_ANONYMOUSLY.

  • Anonymous user can visit the homepage which contains article list, and they can visit the content by clicking article link.
  • User with role ROLE_USER is allowed to post new article and edit their own articles.
  • User with role ROLE_EDITOR is most powerful user who is able to edit and delete any article.

This article will based on the implementation requirements of this application to demonstrate the integration of Spring Security and ZK.

Spring Security Configuration

First, let's see how to configure our project.

Http Element Setting

Authentication Manager Setting

Protecting a Page Request

Login Page Implementation in ZK

Securing Partial View By Using EL in ZUL

ZK's Special Component Attributes for Security

Disable & Visible

ZK EE Sever-side Event Disablement Filtering

ZK Ajax Request Security Handling


Comments



Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.