Seam SVN: r8661 - trunk/src/wicket/org/jboss/seam/wicket.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-08-12 00:29:20 -0400 (Tue, 12 Aug 2008)
New Revision: 8661
Modified:
trunk/src/wicket/org/jboss/seam/wicket/SeamAuthorizationStrategy.java
trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
Log:
JBSEAM-3192
Modified: trunk/src/wicket/org/jboss/seam/wicket/SeamAuthorizationStrategy.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/SeamAuthorizationStrategy.java 2008-08-12 02:24:23 UTC (rev 8660)
+++ trunk/src/wicket/org/jboss/seam/wicket/SeamAuthorizationStrategy.java 2008-08-12 04:29:20 UTC (rev 8661)
@@ -5,12 +5,9 @@
import org.apache.wicket.RestartResponseAtInterceptPageException;
import org.apache.wicket.authorization.Action;
import org.apache.wicket.authorization.IAuthorizationStrategy;
-import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
-import org.jboss.seam.security.Identity;
import org.jboss.seam.security.NotLoggedInException;
-import org.jboss.seam.util.Strings;
/**
* An authorization strategy for Wicket backed by Seam Security
@@ -47,25 +44,22 @@
*/
public boolean isInstantiationAuthorized(Class componentClass)
{
- Restrict restrict = (Restrict) componentClass.getAnnotation(Restrict.class);
- if ( restrict != null && Identity.isSecurityEnabled() )
+ try
{
- String expr = !Strings.isEmpty( restrict.value() ) ? restrict.value() : "#{identity.loggedIn}";
- try
- {
- Identity.instance().checkRestriction(expr);
- }
- catch (NotLoggedInException e)
- {
- log.error("Unauthorized access to " + componentClass.getName() + ", user not logged in", e);
- return handleException(componentClass);
- }
- catch (org.jboss.seam.security.AuthorizationException e)
- {
- log.error("Unauthorized access to " + componentClass.getName(), e);
- return handleException(componentClass);
- }
+ WicketComponent instance = WicketComponent.getInstance(componentClass);
+ if (instance != null) instance.checkRestrictions();
}
+ catch (NotLoggedInException e)
+ {
+ log.error("Unauthorized access to " + componentClass.getName() + ", user not logged in", e);
+ return handleException(componentClass);
+ }
+ catch (org.jboss.seam.security.AuthorizationException e)
+ {
+ log.error("Unauthorized access to " + componentClass.getName(), e);
+ return handleException(componentClass);
+ }
+
return true;
}
Modified: trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java 2008-08-12 02:24:23 UTC (rev 8660)
+++ trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java 2008-08-12 04:29:20 UTC (rev 8661)
@@ -3,6 +3,7 @@
import static org.jboss.seam.ScopeType.STATELESS;
import static org.jboss.seam.ScopeType.UNSPECIFIED;
+import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -13,6 +14,7 @@
import java.util.List;
import java.util.Set;
+import org.apache.wicket.util.string.Strings;
import org.jboss.seam.Component;
import org.jboss.seam.Namespace;
import org.jboss.seam.RequiredException;
@@ -26,12 +28,15 @@
import org.jboss.seam.annotations.bpm.BeginTask;
import org.jboss.seam.annotations.bpm.EndTask;
import org.jboss.seam.annotations.bpm.StartTask;
+import org.jboss.seam.annotations.security.Restrict;
+import org.jboss.seam.annotations.security.RoleCheck;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Init;
import org.jboss.seam.log.Log;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
+import org.jboss.seam.security.Identity;
import org.jboss.seam.wicket.ioc.BijectedAttribute;
import org.jboss.seam.wicket.ioc.BijectedField;
import org.jboss.seam.wicket.ioc.BijectedMethod;
@@ -89,6 +94,8 @@
private List<StatelessInterceptor<T>> interceptors = new ArrayList<StatelessInterceptor<T>>();
+ private Set<String> restrictions;
+
boolean anyMethodHasRaiseEvent = false;
public Class<?> getType()
@@ -163,6 +170,8 @@
scan();
+ scanRestrictions();
+
initInterceptors();
Contexts.getApplicationContext().set(getName(), this);
@@ -184,6 +193,44 @@
add(constructor);
}
}
+
+ private void scanRestrictions()
+ {
+ Class cls = type;
+
+ while (cls != null)
+ {
+ for (Annotation annotation : cls.getAnnotations())
+ {
+ if (annotation instanceof Restrict)
+ {
+ Restrict restrict = (Restrict) annotation;
+ if (restrictions == null) restrictions = new HashSet<String>();
+ restrictions.add(Strings.isEmpty(restrict.value()) ? "#{identity.loggedIn}" : restrict.value());
+ }
+
+ if (annotation.annotationType().isAnnotationPresent(RoleCheck.class))
+ {
+ if (restrictions == null) restrictions = new HashSet<String>();
+ restrictions.add("#{identity.hasRole('" +
+ annotation.annotationType().getSimpleName().toLowerCase() + "')}");
+ }
+ }
+
+ cls = cls.getEnclosingClass();
+ }
+ }
+
+ public void checkRestrictions()
+ {
+ if (Identity.isSecurityEnabled() && restrictions != null)
+ {
+ for (String restriction : restrictions)
+ {
+ Identity.instance().checkRestriction(restriction);
+ }
+ }
+ }
public void outject(T target)
{
15 years, 9 months
Seam SVN: r8659 - trunk/doc.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-08-11 22:20:58 -0400 (Mon, 11 Aug 2008)
New Revision: 8659
Added:
trunk/doc/enterprise/
Log:
directory for enterprise documentation
15 years, 9 months
Seam SVN: r8658 - branches/Seam_2_0_FP/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-08-11 17:49:47 -0400 (Mon, 11 Aug 2008)
New Revision: 8658
Modified:
branches/Seam_2_0_FP/build/root.pom.xml
Log:
JBPAPP-1058
Modified: branches/Seam_2_0_FP/build/root.pom.xml
===================================================================
--- branches/Seam_2_0_FP/build/root.pom.xml 2008-08-11 21:04:21 UTC (rev 8657)
+++ branches/Seam_2_0_FP/build/root.pom.xml 2008-08-11 21:49:47 UTC (rev 8658)
@@ -38,12 +38,12 @@
<id>snapshots.jboss.org</id>
<name>JBoss Snapshot Repository</name>
<url>http://snapshots.jboss.org/maven2</url>
- </repository>
+ </repository>
</repositories>
<!-- Externalize some version numbers here -->
<properties>
- <version.richfaces>3.1.4.GA</version.richfaces>
+ <version.richfaces>3.1.6.GA</version.richfaces>
<version.drools>4.0.7-SOA-P</version.drools>
</properties>
@@ -156,7 +156,13 @@
</exclusion>
</exclusions>
</dependency>
-
+
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.7-brew</version>
+ </dependency>
+
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-impl</artifactId>
@@ -176,7 +182,7 @@
</exclusion>
</exclusions>
</dependency>
-
+
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
@@ -487,7 +493,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.5.4</version>
+ <version>1.5.6</version>
<exclusions>
<!-- groovy-all imports a lot of stuff, would be better to just use specific bits -->
<exclusion>
@@ -644,7 +650,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
- <version>2.0.6</version>
+ <version>2.0.8</version>
<exclusions>
<!-- Prevent the insanity which is commons-logging pom introducing dependencies on weird stuff -->
<exclusion>
@@ -752,7 +758,7 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
- <version>1.4.60</version>
+ <version>1.4.62</version>
</dependency>
<dependency>
15 years, 9 months
Seam SVN: r8657 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2008-08-11 17:04:21 -0400 (Mon, 11 Aug 2008)
New Revision: 8657
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
Log:
Minor. Fix for (R) issue with title
Modified: trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-08-11 20:55:35 UTC (rev 8656)
+++ trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-08-11 21:04:21 UTC (rev 8657)
@@ -1,7 +1,7 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-<!ENTITY excel 'the <trademark class="registered">Microsoft</trademark> <trademark class="registered">Excel</trademark> spreadsheet application'>
-<!ENTITY Excel 'The <trademark class="registered">Microsoft</trademark> <trademark class="registered">Excel</trademark> spreadsheet application'>
+<!ENTITY excel 'the Microsoft® Excel® spreadsheet application'>
+<!ENTITY Excel 'the Microsoft® Excel® spreadsheet application'>
]>
<chapter id="excel">
15 years, 9 months
Seam SVN: r8656 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-08-11 16:55:35 -0400 (Mon, 11 Aug 2008)
New Revision: 8656
Modified:
trunk/src/main/org/jboss/seam/Component.java
Log:
JBSEAM-3163
Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java 2008-08-11 19:45:50 UTC (rev 8655)
+++ trunk/src/main/org/jboss/seam/Component.java 2008-08-11 20:55:35 UTC (rev 8656)
@@ -502,7 +502,11 @@
}
else if ( propertyValue.isMultiValued() )
{
- return new ListInitialValue(propertyValue, parameterClass, parameterType);
+ if (Set.class.isAssignableFrom(parameterClass)) {
+ return new SetInitialValue(propertyValue, parameterClass, parameterType);
+ } else {
+ return new ListInitialValue(propertyValue, parameterClass, parameterType);
+ }
}
else if ( propertyValue.isAssociativeValued() )
{
@@ -2464,6 +2468,39 @@
}
+ static class SetInitialValue implements InitialValue
+ {
+ private InitialValue[] initialValues;
+ private Class elementType;
+
+ public SetInitialValue(PropertyValue propertyValue, Class collectionClass, Type collectionType)
+ {
+ String[] expressions = propertyValue.getMultiValues();
+ initialValues = new InitialValue[expressions.length];
+ elementType = Reflections.getCollectionElementType(collectionType);
+ for ( int i=0; i<expressions.length; i++ )
+ {
+ PropertyValue elementValue = new Conversions.FlatPropertyValue( expressions[i] );
+ initialValues[i] = getInitialValue(elementValue, elementType, elementType);
+ }
+ }
+
+ public Object getValue(Class type)
+ {
+ Set set = new HashSet(initialValues.length);
+ for (InitialValue iv: initialValues) {
+ set.add( iv.getValue(elementType) );
+ }
+ return set;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "SetInitialValue(" + elementType.getSimpleName() + ")";
+ }
+ }
+
static class ListInitialValue implements InitialValue
{
private InitialValue[] initialValues;
15 years, 9 months
Seam SVN: r8655 - trunk/src/excel/org/jboss/seam/excel/jxl.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2008-08-11 15:45:50 -0400 (Mon, 11 Aug 2008)
New Revision: 8655
Modified:
trunk/src/excel/org/jboss/seam/excel/jxl/JXLTemplates.java
Log:
JBSEAM-3235. Fixed. Again. Minor typo also corrected.
Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLTemplates.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLTemplates.java 2008-08-11 19:43:40 UTC (rev 8654)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLTemplates.java 2008-08-11 19:45:50 UTC (rev 8655)
@@ -184,7 +184,7 @@
worksheetTemplates.put(template.getName(), (UIWorksheetTemplate) template);
break;
default:
- throw new ExcelWorkbookException(Interpolator.instance().interpolate("Uknown template type {0}", template.getType()));
+ throw new ExcelWorkbookException(Interpolator.instance().interpolate("Unknown template type {0}", template.getType()));
}
}
@@ -207,9 +207,7 @@
if (cellTemplate == null)
{
String validNames = getValidTemplateNames(cellTemplates.keySet());
- if (!"".equals(validNames)) {
- log.warn(Interpolator.instance().interpolate("Could not find cell template {0}, try {1}", templateName, validNames));
- }
+ log.trace(Interpolator.instance().interpolate("Could not find cell template {0}, try {1}", templateName, validNames));
}
else
{
15 years, 9 months
Seam SVN: r8654 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2008-08-11 15:43:40 -0400 (Mon, 11 Aug 2008)
New Revision: 8654
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
Log:
Minor. Reminder to import namespace in components.xml
Modified: trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-08-11 12:32:12 UTC (rev 8653)
+++ trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-08-11 19:43:40 UTC (rev 8654)
@@ -52,7 +52,12 @@
</excel:excelFactory>
]]>
</programlisting>
-
+ and register the excel namespace in the components tag with
+ <programlisting role="XML">
+ <![CDATA[
+ xmlns:excel="http://jboss.com/products/seam/excel"
+ ]]>
+ </programlisting>
Then set the UIWorkbook type to <literal>myExcelExporter</literal> and your
own exporter will be used. Default is "jxl", but support for CSV has also been
added, using the type "csv".
15 years, 9 months
Seam SVN: r8653 - branches/Seam_2_0_FP/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-08-11 08:32:12 -0400 (Mon, 11 Aug 2008)
New Revision: 8653
Modified:
branches/Seam_2_0_FP/build/root.pom.xml
Log:
JBPAPP-1020 - the last alignment of dom4j and javax.mail
Modified: branches/Seam_2_0_FP/build/root.pom.xml
===================================================================
--- branches/Seam_2_0_FP/build/root.pom.xml 2008-08-11 12:06:59 UTC (rev 8652)
+++ branches/Seam_2_0_FP/build/root.pom.xml 2008-08-11 12:32:12 UTC (rev 8653)
@@ -433,7 +433,7 @@
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
- <version>1.4</version>
+ <version>1.4.1</version>
</dependency>
<dependency>
@@ -758,7 +758,7 @@
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1-jboss</version>
+ <version>1.6.1-brew</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
15 years, 9 months
Seam SVN: r8652 - trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-08-11 08:06:59 -0400 (Mon, 11 Aug 2008)
New Revision: 8652
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java
Log:
Minor
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java 2008-08-11 04:37:57 UTC (rev 8651)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java 2008-08-11 12:06:59 UTC (rev 8652)
@@ -2,6 +2,7 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.wiki.core.action.prefs.UserManagementPreferences;
import org.jboss.seam.wiki.core.model.Role;
import org.jboss.seam.wiki.core.model.User;
@@ -27,6 +28,7 @@
// Anonymous (not logged-in) user's access level
@Factory(value = "currentAccessLevel", scope = ScopeType.SESSION, autoCreate = true)
+ @BypassInterceptors // Don't inject the entityManager, this factory is called when the entityManager is created!
public Integer getCurrentAccessLevel() {
return Role.GUESTROLE_ACCESSLEVEL;
}
15 years, 9 months
Seam SVN: r8650 - in trunk/src/main/org/jboss/seam: web and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-08-10 12:32:05 -0400 (Sun, 10 Aug 2008)
New Revision: 8650
Added:
trunk/src/main/org/jboss/seam/web/IdentityFilter.java
trunk/src/main/org/jboss/seam/web/IdentityRequestWrapper.java
Modified:
trunk/src/main/org/jboss/seam/web-2.1.xsd
Log:
JBSEAM-3249
Added: trunk/src/main/org/jboss/seam/web/IdentityFilter.java
===================================================================
--- trunk/src/main/org/jboss/seam/web/IdentityFilter.java (rev 0)
+++ trunk/src/main/org/jboss/seam/web/IdentityFilter.java 2008-08-10 16:32:05 UTC (rev 8650)
@@ -0,0 +1,40 @@
+package org.jboss.seam.web;
+
+import java.io.IOException;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.annotations.web.Filter;
+
+/**
+ * A filter that provides integration between Servlet Security and the Seam
+ * identity component. This integration is accomplished by wrapping the
+ * HttpServletRequest with an HttpServletRequestWrapper implementation that
+ * delegates security-related calls to the Seam identity component.
+ *
+ * @author Dan Allen
+ */
+(a)Scope(ScopeType.APPLICATION)
+@Name("org.jboss.seam.web.identityFilter")
+@Install(precedence = Install.BUILT_IN, dependencies = "org.jboss.seam.security.identity")
+@BypassInterceptors
+@Filter(within = {"org.jboss.seam.web.multipartFilter"})
+public class IdentityFilter extends AbstractFilter {
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ throws IOException, ServletException {
+ if (!(request instanceof HttpServletRequest)) {
+ throw new ServletException("This filter can only process HttpServletRequest requests");
+ }
+
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ chain.doFilter(new IdentityRequestWrapper(httpRequest), response);
+ }
+}
Added: trunk/src/main/org/jboss/seam/web/IdentityRequestWrapper.java
===================================================================
--- trunk/src/main/org/jboss/seam/web/IdentityRequestWrapper.java (rev 0)
+++ trunk/src/main/org/jboss/seam/web/IdentityRequestWrapper.java 2008-08-10 16:32:05 UTC (rev 8650)
@@ -0,0 +1,39 @@
+package org.jboss.seam.web;
+
+import java.security.Principal;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import org.jboss.seam.Seam;
+import org.jboss.seam.security.Identity;
+
+/**
+ * An HttpServletRequestWrapper implementation that provides integration
+ * between Servlet Security and the Seam identity component.
+ *
+ * @author Dan Allen
+ */
+class IdentityRequestWrapper extends HttpServletRequestWrapper {
+
+ private Identity identity;
+
+ public IdentityRequestWrapper(HttpServletRequest request) {
+ super(request);
+ identity = (Identity) request.getSession().
+ getAttribute(Seam.getComponentName(Identity.class));
+ }
+
+ @Override
+ public String getRemoteUser() {
+ return getUserPrincipal() != null ? getUserPrincipal().getName() : null;
+ }
+
+ @Override
+ public Principal getUserPrincipal() {
+ return Identity.isSecurityEnabled() ? identity.getPrincipal() : null;
+ }
+
+ @Override
+ public boolean isUserInRole(String role) {
+ return getUserPrincipal() != null ? identity.hasRole(role) : false;
+ }
+}
Modified: trunk/src/main/org/jboss/seam/web-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/web-2.1.xsd 2008-08-10 16:31:18 UTC (rev 8649)
+++ trunk/src/main/org/jboss/seam/web-2.1.xsd 2008-08-10 16:32:05 UTC (rev 8650)
@@ -4,6 +4,16 @@
xmlns:components="http://jboss.com/products/seam/components" attributeFormDefault="unqualified">
<xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
+ <xs:element name="identity-filter">
+ <xs:annotation>
+ <xs:documentation>This filter provides integration between Servlet Security and the identity component.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="web:attlist.filter"/>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="multipart-filter">
<xs:annotation>
<xs:documentation>
15 years, 9 months