You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by bu...@apache.org on 2012/12/15 21:21:07 UTC

svn commit: r842544 - in /websites/staging/deltaspike/trunk/content: ./ deltaspike/security.html

Author: buildbot
Date: Sat Dec 15 20:21:06 2012
New Revision: 842544

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/deltaspike/security.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Dec 15 20:21:06 2012
@@ -1 +1 @@
-1422340
+1422342

Modified: websites/staging/deltaspike/trunk/content/deltaspike/security.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/deltaspike/security.html (original)
+++ websites/staging/deltaspike/trunk/content/deltaspike/security.html Sat Dec 15 20:21:06 2012
@@ -80,8 +80,8 @@
               <p><h2 id="securitybinding-for-class-and-method-invocations">SecurityBinding for class and method invocations</h2>
 <p>This feature of the security module functions by intercepting method calls, and performing a security check before invocation is allowed to proceed.</p>
 <p>In order to use the DeltaSpike security module, you must first have installed the proper dependencies into your POM file. Once this is complete, you may proceed to create a security parameter binding annotation. This is what we will use to add security behavior to our business classes and methods.</p>
-<div class="codehilite"><pre><span class="n">Create</span> <span class="n">the</span> <span class="n">SecurityBinding</span>
-<span class="nv">@Retention</span><span class="p">(</span><span class="n">value</span> <span class="o">=</span> <span class="n">RUNTIME</span><span class="p">)</span>
+<p>Create the SecurityBinding:</p>
+<div class="codehilite"><pre><span class="nv">@Retention</span><span class="p">(</span><span class="n">value</span> <span class="o">=</span> <span class="n">RUNTIME</span><span class="p">)</span>
 <span class="nv">@Target</span><span class="p">({</span><span class="n">TYPE</span><span class="p">,</span> <span class="n">METHOD</span><span class="p">})</span>
 <span class="nv">@Documented</span>
 <span class="nv">@SecurityBindingType</span>
@@ -92,8 +92,8 @@
 
 <p>Next, we must define an Authorizer class to implement behavior for our custom SecurityBindingType. This class is simply a CDI bean which declares a @Secures method, qualified with the security binding annotation we created in the first step.</p>
 <p>This method has access to the InvocationContext of the method call, so if we need to access parameter arguments, we can do so using the given context. Note that we may also inject other beans into the parameter list of our @Secures method.</p>
-<div class="codehilite"><pre><span class="n">Create</span> <span class="n">the</span> <span class="n">Authorizer</span>
-<span class="nv">@ApplicationScoped</span>
+<p>Create the Authorizer:</p>
+<div class="codehilite"><pre><span class="nv">@ApplicationScoped</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">CustomAuthorizer</span>
 <span class="p">{</span>
     <span class="nv">@Secures</span>
@@ -107,8 +107,8 @@
 
 
 <p>We can then use our new annotation to secure business or bean methods. This binding annotation may be placed on the entire class (securing all methods,) or on individual methods that you wish to secure.</p>
-<div class="codehilite"><pre><span class="n">Secure</span> <span class="n">a</span> <span class="n">bean</span> <span class="n">method</span>
-<span class="nv">@ApplicationScoped</span>
+<p>Secure a bean method:</p>
+<div class="codehilite"><pre><span class="nv">@ApplicationScoped</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">SecuredBean1</span>
 <span class="p">{</span>
     <span class="nv">@CustomSecurityBinding</span>
@@ -121,8 +121,8 @@
 
 
 <p>Next, we may access parameter values from the method invocation directly in our authorizer bean by creating custom @SecurityParameterBinding types; this is a simple step once we have completed the work above:</p>
-<div class="codehilite"><pre><span class="n">Create</span> <span class="n">a</span> <span class="n">parameter</span> <span class="n">binding</span> <span class="n">annotation</span>
-<span class="nv">@Retention</span><span class="p">(</span><span class="n">value</span> <span class="o">=</span> <span class="n">RUNTIME</span><span class="p">)</span>
+<p>Create a parameter binding annotation:</p>
+<div class="codehilite"><pre><span class="nv">@Retention</span><span class="p">(</span><span class="n">value</span> <span class="o">=</span> <span class="n">RUNTIME</span><span class="p">)</span>
 <span class="nv">@Target</span><span class="p">({</span><span class="n">PARAMETER</span><span class="p">})</span>
 <span class="nv">@Documented</span>
 <span class="nv">@SecurityParameterBinding</span>
@@ -132,8 +132,8 @@
 
 
 <p>Now, when a secured method is invoked, we can inject actual parameter values as arguments into our authorizer method, providing domain-level security in our applications:</p>
-<div class="codehilite"><pre><span class="n">Update</span> <span class="n">the</span> <span class="n">Authorizer</span> <span class="n">to</span> <span class="k">use</span> <span class="n">parameter</span> <span class="n">binding</span>
-<span class="nv">@ApplicationScoped</span>
+<p>Update the Authorizer to use parameter binding:</p>
+<div class="codehilite"><pre><span class="nv">@ApplicationScoped</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">CustomAuthorizer</span>
 <span class="p">{</span>
     <span class="nv">@Secures</span>
@@ -147,8 +147,8 @@
 
 
 <p>Note that our business method must also be annotated.</p>
-<div class="codehilite"><pre><span class="n">Complete</span> <span class="n">the</span> <span class="n">parameter</span> <span class="n">binding</span>
-<span class="nv">@ApplicationScoped</span>
+<p>Complete the parameter binding:</p>
+<div class="codehilite"><pre><span class="nv">@ApplicationScoped</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">SecuredBean1</span>
 <span class="p">{</span>
     <span class="nv">@CustomSecurityBinding</span>
@@ -163,11 +163,11 @@
 <p>Our method is now secured, and we are able to use given parameter values as part of our security authorizer!</p>
 <h2 id="integrating-3rd-party-security-frameworks">Integrating 3rd party security frameworks</h2>
 <h3 id="secured">@Secured</h3>
-<p>{{@Secured}} is build on {{@SecurityBindingType}} and a very simple alternative to the rest of the security module.
+<p><code>@Secured</code> is build on <code>@SecurityBindingType</code> and a very simple alternative to the rest of the security module.
 It's a basic hook to integrate a custom security concept, 3rd party frameworks,... . It doesn't provide a full blown security concept like the rest of the security module, but other DeltaSpike modules ensure that the security concepts are integrated properly (e.g. correct behaviour within custom scope implementations,...). It just allows to integrate other security frameworks easily.</p>
-<p>(In MyFaces CODI it was originally a CDI interceptor. This part changed a bit, because between the interceptor and {{@Secured}} is the {{@SecurityBindingType}} concept which triggers {{@Secured}} as on possible approach. Therefore the basic behaviour remains the same and you can think about it like an interceptor.)</p>
-<div class="codehilite"><pre><span class="n">Securing</span> <span class="n">all</span> <span class="n">intercepted</span> <span class="n">methods</span> <span class="n">of</span> <span class="n">a</span> <span class="n">CDI</span> <span class="n">bean</span>
-<span class="sr">//</span><span class="o">...</span>
+<p>(In MyFaces CODI it was originally a CDI interceptor. This part changed a bit, because between the interceptor and <code>@Secured</code> is the <code>@SecurityBindingType</code> concept which triggers <code>@Secured</code> as on possible approach. Therefore the basic behaviour remains the same and you can think about it like an interceptor.)</p>
+<p>Securing all intercepted methods of a CDI bean:</p>
+<div class="codehilite"><pre><span class="sr">//</span><span class="o">...</span>
 <span class="nv">@Secured</span><span class="p">(</span><span class="n">CustomAccessDecisionVoter</span><span class="o">.</span><span class="n">class</span><span class="p">)</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">SecuredBean</span>
 <span class="p">{</span>
@@ -177,8 +177,8 @@ It's a basic hook to integrate a custom 
 
 
 <p>or</p>
-<div class="codehilite"><pre><span class="n">Securing</span> <span class="n">specific</span> <span class="n">methods</span>
-<span class="sr">//</span><span class="o">...</span>
+<p>Securing specific methods:</p>
+<div class="codehilite"><pre><span class="sr">//</span><span class="o">...</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">SecuredBean</span>
 <span class="p">{</span>
     <span class="nv">@Secured</span><span class="p">(</span><span class="n">CustomAccessDecisionVoter</span><span class="o">.</span><span class="n">class</span><span class="p">)</span>
@@ -191,7 +191,7 @@ It's a basic hook to integrate a custom 
 
 
 <h3 id="accessdecisionvoter">AccessDecisionVoter</h3>
-<p>This interface is (besides the {{Secured}} annotation) the most important part of the concept. Both artifact types are also the only required parts.</p>
+<p>This interface is (besides the <code>Secured</code> annotation) the most important part of the concept. Both artifact types are also the only required parts:</p>
 <div class="codehilite"><pre><span class="n">public</span> <span class="n">class</span> <span class="n">CustomAccessDecisionVoter</span> <span class="n">implements</span> <span class="n">AccessDecisionVoter</span>
 <span class="p">{</span>
     <span class="nv">@Override</span>
@@ -207,12 +207,12 @@ It's a basic hook to integrate a custom 
 
 <p>[TODO] hint about the changed parameter/s</p>
 <h3 id="securityviolation">SecurityViolation</h3>
-<p>In case of a detected violation a {{SecurityViolation}} has to be added to the result returned by the {{AccessDecisionVoter}}.</p>
+<p>In case of a detected violation a <code>SecurityViolation</code> has to be added to the result returned by the <code>AccessDecisionVoter</code>.</p>
 <p>[TODO] AbstractAccessDecisionVoter</p>
 <h3 id="secured-and-stereotypes-with-custom-meta-data">@Secured and Stereotypes with custom Meta-data</h3>
-<p>If there are multiple {{AccessDecisionVoter}} and maybe in different constellations, it's easier to provide an expressive CDI stereotypes for it. Later on that also allows to change the behaviour in a central place.</p>
-<div class="codehilite"><pre><span class="n">Stereotype</span> <span class="n">support</span> <span class="n">of</span> <span class="nv">@Secured</span><span class="p">}</span>
-<span class="nv">@Named</span>
+<p>If there are multiple <code>AccessDecisionVoter</code> and maybe in different constellations, it's easier to provide an expressive CDI stereotypes for it. Later on that also allows to change the behaviour in a central place.</p>
+<p>Stereotype support of @Secured:</p>
+<div class="codehilite"><pre><span class="nv">@Named</span>
 <span class="nv">@Admin</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">MyBean</span> <span class="n">implements</span> <span class="n">Serializable</span>
 <span class="p">{</span>
@@ -229,8 +229,8 @@ It's a basic hook to integrate a custom 
 
 
 <p>Furthermore, it's possible to provide custom meta-data easily.</p>
-<div class="codehilite"><pre><span class="n">Stereotype</span> <span class="n">of</span> <span class="nv">@Secured</span> <span class="n">with</span> <span class="n">custom</span> <span class="n">meta</span><span class="o">-</span><span class="n">data</span><span class="p">}</span>
-<span class="nv">@Named</span>
+<p>Stereotype of @Secured with custom meta-data:</p>
+<div class="codehilite"><pre><span class="nv">@Named</span>
 <span class="nv">@Admin</span><span class="p">(</span><span class="n">securityLevel</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
 <span class="n">public</span> <span class="n">class</span> <span class="n">MyBean</span> <span class="n">implements</span> <span class="n">Serializable</span>
 <span class="p">{</span>