Author: shane.bryzak(a)jboss.com
Date: 2008-04-14 00:03:34 -0400 (Mon, 14 Apr 2008)
New Revision: 7929
Added:
trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java
trunk/src/main/org/jboss/seam/annotations/security/permission/
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionAction.java
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionDiscriminator.java
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionRole.java
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionTarget.java
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionUser.java
Removed:
trunk/src/main/org/jboss/seam/annotations/security/PermissionAction.java
Modified:
trunk/src/main/org/jboss/seam/annotations/security/Delete.java
trunk/src/main/org/jboss/seam/annotations/security/Insert.java
trunk/src/main/org/jboss/seam/annotations/security/Read.java
trunk/src/main/org/jboss/seam/annotations/security/Update.java
trunk/src/main/org/jboss/seam/security/SecurityInterceptor.java
Log:
renamed PermissionAction -> PermissionCheck, new permission annotations
Modified: trunk/src/main/org/jboss/seam/annotations/security/Delete.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/Delete.java 2008-04-13 22:55:00 UTC
(rev 7928)
+++ trunk/src/main/org/jboss/seam/annotations/security/Delete.java 2008-04-14 04:03:34 UTC
(rev 7929)
@@ -17,7 +17,7 @@
@Documented
@Retention(RUNTIME)
@Inherited
-@PermissionAction("delete")
+@PermissionCheck("delete")
public @interface Delete {
Class value();
}
Modified: trunk/src/main/org/jboss/seam/annotations/security/Insert.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/Insert.java 2008-04-13 22:55:00 UTC
(rev 7928)
+++ trunk/src/main/org/jboss/seam/annotations/security/Insert.java 2008-04-14 04:03:34 UTC
(rev 7929)
@@ -17,7 +17,7 @@
@Documented
@Retention(RUNTIME)
@Inherited
-@PermissionAction("insert")
+@PermissionCheck("insert")
public @interface Insert {
Class value();
}
Deleted: trunk/src/main/org/jboss/seam/annotations/security/PermissionAction.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/PermissionAction.java 2008-04-13
22:55:00 UTC (rev 7928)
+++ trunk/src/main/org/jboss/seam/annotations/security/PermissionAction.java 2008-04-14
04:03:34 UTC (rev 7929)
@@ -1,24 +0,0 @@
-package org.jboss.seam.annotations.security;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Meta-annotation that designates an annotation as being a permission action,
- * requiring a security check prior to invoking the annotated method or class
- *
- * @author Shane Bryzak
- */
-@Target({TYPE})
-@Documented
-@Retention(RUNTIME)
-@Inherited
-public @interface PermissionAction
-{
- String value() default "";
-}
Added: trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java
(rev 0)
+++ trunk/src/main/org/jboss/seam/annotations/security/PermissionCheck.java 2008-04-14
04:03:34 UTC (rev 7929)
@@ -0,0 +1,24 @@
+package org.jboss.seam.annotations.security;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Meta-annotation that designates an annotation as being a permission action,
+ * requiring a security check prior to invoking the annotated method or class
+ *
+ * @author Shane Bryzak
+ */
+@Target({TYPE})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionCheck
+{
+ String value() default "";
+}
Modified: trunk/src/main/org/jboss/seam/annotations/security/Read.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/Read.java 2008-04-13 22:55:00 UTC
(rev 7928)
+++ trunk/src/main/org/jboss/seam/annotations/security/Read.java 2008-04-14 04:03:34 UTC
(rev 7929)
@@ -17,7 +17,7 @@
@Documented
@Retention(RUNTIME)
@Inherited
-@PermissionAction("read")
+@PermissionCheck("read")
public @interface Read {
Class value();
}
Modified: trunk/src/main/org/jboss/seam/annotations/security/Update.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/Update.java 2008-04-13 22:55:00 UTC
(rev 7928)
+++ trunk/src/main/org/jboss/seam/annotations/security/Update.java 2008-04-14 04:03:34 UTC
(rev 7929)
@@ -17,7 +17,7 @@
@Documented
@Retention(RUNTIME)
@Inherited
-@PermissionAction("update")
+@PermissionCheck("update")
public @interface Update {
Class value();
}
Added:
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionAction.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionAction.java
(rev 0)
+++
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionAction.java 2008-04-14
04:03:34 UTC (rev 7929)
@@ -0,0 +1,25 @@
+package org.jboss.seam.annotations.security.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the action component of a permission,
e.g. "update",
+ * "delete".
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionAction
+{
+
+}
Added:
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionDiscriminator.java
===================================================================
---
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionDiscriminator.java
(rev 0)
+++
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionDiscriminator.java 2008-04-14
04:03:34 UTC (rev 7929)
@@ -0,0 +1,25 @@
+package org.jboss.seam.annotations.security.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the discriminator column in a
permission table
+ * that contains permissions for both roles and users.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionDiscriminator
+{
+
+}
Added: trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionRole.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionRole.java
(rev 0)
+++
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionRole.java 2008-04-14
04:03:34 UTC (rev 7929)
@@ -0,0 +1,24 @@
+package org.jboss.seam.annotations.security.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the role that a permission is assigned
to.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionRole
+{
+
+}
Added:
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionTarget.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionTarget.java
(rev 0)
+++
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionTarget.java 2008-04-14
04:03:34 UTC (rev 7929)
@@ -0,0 +1,24 @@
+package org.jboss.seam.annotations.security.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the target of a permission.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionTarget
+{
+
+}
Added: trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionUser.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionUser.java
(rev 0)
+++
trunk/src/main/org/jboss/seam/annotations/security/permission/PermissionUser.java 2008-04-14
04:03:34 UTC (rev 7929)
@@ -0,0 +1,25 @@
+package org.jboss.seam.annotations.security.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the principal (username) that a
permission is
+ * assigned to.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionUser
+{
+
+}
Modified: trunk/src/main/org/jboss/seam/security/SecurityInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/SecurityInterceptor.java 2008-04-13 22:55:00
UTC (rev 7928)
+++ trunk/src/main/org/jboss/seam/security/SecurityInterceptor.java 2008-04-14 04:03:34
UTC (rev 7929)
@@ -8,7 +8,7 @@
import org.jboss.seam.annotations.intercept.AroundInvoke;
import org.jboss.seam.annotations.intercept.Interceptor;
import org.jboss.seam.annotations.intercept.InterceptorType;
-import org.jboss.seam.annotations.security.PermissionAction;
+import org.jboss.seam.annotations.security.PermissionCheck;
import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.async.AsynchronousInterceptor;
import org.jboss.seam.intercept.AbstractInterceptor;
@@ -114,9 +114,9 @@
for (Annotation annotation : method.getAnnotations())
{
- if
(annotation.annotationType().isAnnotationPresent(PermissionAction.class))
+ if
(annotation.annotationType().isAnnotationPresent(PermissionCheck.class))
{
- PermissionAction permissionAction =
annotation.annotationType().getAnnotation(PermissionAction.class);
+ PermissionCheck permissionAction =
annotation.annotationType().getAnnotation(PermissionCheck.class);
Method valueMethod = null;
for (Method m : annotation.annotationType().getDeclaredMethods())