Skip to content

Instantly share code, notes, and snippets.

@LightGuard
Created October 26, 2011 06:18
Show Gist options
  • Save LightGuard/1315602 to your computer and use it in GitHub Desktop.
Save LightGuard/1315602 to your computer and use it in GitHub Desktop.
SEAMFACES-210 idea
diff --git a/impl/src/main/java/org/jboss/seam/faces/view/config/ViewConfigExtension.java b/impl/src/main/java/org/jboss/seam/faces/view/config/ViewConfigExtension.java
index 8d9cc59..610be78 100644
--- a/impl/src/main/java/org/jboss/seam/faces/view/config/ViewConfigExtension.java
+++ b/impl/src/main/java/org/jboss/seam/faces/view/config/ViewConfigExtension.java
@@ -59,6 +60,14 @@ public class ViewConfigExtension implements Extension {
log.warn("ViewConfig annotation should only be applied to interfaces, and [" + tp.getJavaClass()
+ "] is not an interface.");
} else {
+ // SEAMFACES-210
+ boolean securityNotFound = false;
+ try {
+ this.getClass().getClassLoader().loadClass("org.jboss.seam.security.annotations.SecurityBindingType");
+ } catch (ClassNotFoundException e) {
+ securityNotFound = true;
+ }
+
for (Class clazz : tp.getJavaClass().getClasses()) {
for (Field enumm : clazz.getFields())
if (enumm.isAnnotationPresent(ViewPattern.class)) {
@@ -69,6 +78,15 @@ public class ViewConfigExtension implements Extension {
if (a.annotationType() != ViewPattern.class) {
viewPattern.add(a);
}
+
+ // SEAMFACES-210
+ if (securityNotFound) {
+ for (Annotation annotation : a.getClass().getAnnotations()) {
+ if ("SecurityBindingType".equals(annotation.getClass().getSimpleName())) {
+ throw new RuntimeException("Security annotation found without Seam Security present");
+ }
+ }
+ }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment