[jboss-cvs] JBossAS SVN: r94603 - in projects/metadata/web/trunk/src: main/java/org/jboss/metadata/web/jboss and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 9 10:35:49 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-10-09 10:35:48 -0400 (Fri, 09 Oct 2009)
New Revision: 94603
Added:
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/EmptyRoleSemanticType.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpConstraintMetaData.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpMethodConstraintMetaData.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/ServletSecurityMetaData.java
projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb60BindingUnitTestCase.java
Removed:
projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb51BindingUnitTestCase.java
Modified:
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/ServletSecurityProcessor.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/WebComponentProcessor.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossAnnotationMetaData.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossServletMetaData.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java
projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/AnnotationMetaData.java
projects/metadata/web/trunk/src/main/resources/schema/jboss-web_6_0.xsd
Log:
- Move away from direct use of security constraints, which is not really doable due to recent changes.
- Add a direct meta data model for the @ServletSecurity annotation.
- Servlet-security is now configurable in XML, either as the annotation does, or directly on the Servlet.
- Actually test my jboss-web 6.0 schema.
Modified: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/ServletSecurityProcessor.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/ServletSecurityProcessor.java 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/ServletSecurityProcessor.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -29,10 +29,7 @@
import javax.servlet.annotation.HttpConstraint;
import javax.servlet.annotation.HttpMethodConstraint;
-import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.ServletSecurity;
-import javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic;
-import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
import org.jboss.metadata.annotation.creator.AbstractFinderUser;
import org.jboss.metadata.annotation.creator.Creator;
@@ -41,13 +38,10 @@
import org.jboss.metadata.annotation.finder.AnnotationFinder;
import org.jboss.metadata.web.spec.AnnotationMetaData;
import org.jboss.metadata.web.spec.AnnotationsMetaData;
-import org.jboss.metadata.web.spec.AuthConstraintMetaData;
-import org.jboss.metadata.web.spec.MultipartConfigMetaData;
-import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.EmptyRoleSemanticType;
+import org.jboss.metadata.web.spec.HttpMethodConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletSecurityMetaData;
import org.jboss.metadata.web.spec.TransportGuaranteeType;
-import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
/**
* Processor for servlet @ServletSecurity
@@ -55,7 +49,7 @@
* @version $Revision: 67218 $
*/
public class ServletSecurityProcessor extends AbstractFinderUser
- implements Processor<AnnotationsMetaData, Class<?>>, Creator<Class<?>, List<SecurityConstraintMetaData>>
+ implements Processor<AnnotationsMetaData, Class<?>>, Creator<Class<?>, ServletSecurityMetaData>
{
public ServletSecurityProcessor(AnnotationFinder<AnnotatedElement> finder)
{
@@ -68,7 +62,7 @@
if(annotation == null)
return;
- List<SecurityConstraintMetaData> securityConstraints = create(type);
+ ServletSecurityMetaData servletSecurity = create(type);
AnnotationMetaData annotationMD = metaData.get(type.getName());
if (annotationMD == null)
{
@@ -76,18 +70,52 @@
annotationMD.setClassName(type.getName());
metaData.add(annotationMD);
}
- annotationMD.setSecurityConstraints(securityConstraints);
+ annotationMD.setServletSecurity(servletSecurity);
}
- public List<SecurityConstraintMetaData> create(Class<?> element)
+ public ServletSecurityMetaData create(Class<?> element)
{
ServletSecurity servletSecurity = finder.getAnnotation(element, ServletSecurity.class);
if (servletSecurity == null)
return null;
+ ServletSecurityMetaData metaData = new ServletSecurityMetaData();
HttpConstraint httpConstraint = servletSecurity.value();
HttpMethodConstraint[] httpMethodConstraints = servletSecurity.httpMethodConstraints();
+ metaData.setEmptyRoleSemantic(EmptyRoleSemanticType.valueOf(httpConstraint.value().toString()));
+ metaData.setTransportGuarantee(TransportGuaranteeType.valueOf(httpConstraint.transportGuarantee().toString()));
+ List<String> rolesAllowed = new ArrayList<String>();
+ for (String role : httpConstraint.rolesAllowed())
+ {
+ rolesAllowed.add(role);
+ }
+ metaData.setRolesAllowed(rolesAllowed);
+
+ if (httpMethodConstraints != null && httpMethodConstraints.length > 0)
+ {
+ List<HttpMethodConstraintMetaData> methodConstraints =
+ new ArrayList<HttpMethodConstraintMetaData>();
+ for (HttpMethodConstraint httpMethodConstraint : httpMethodConstraints)
+ {
+ HttpMethodConstraintMetaData methodConstraint = new HttpMethodConstraintMetaData();
+ methodConstraint.setMethod(httpMethodConstraint.value());
+ methodConstraint.setEmptyRoleSemantic(EmptyRoleSemanticType.valueOf(httpMethodConstraint.value().toString()));
+ methodConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(httpMethodConstraint.transportGuarantee().toString()));
+ rolesAllowed = new ArrayList<String>();
+ for (String role : httpMethodConstraint.rolesAllowed())
+ {
+ rolesAllowed.add(role);
+ }
+ methodConstraint.setRolesAllowed(rolesAllowed);
+ methodConstraints.add(methodConstraint);
+ }
+ metaData.setHttpMethodConstraints(methodConstraints);
+ }
+
+ return metaData;
+
+ /*
List<SecurityConstraintMetaData> metaData = new ArrayList<SecurityConstraintMetaData>();
ArrayList<String> methodOmissions = new ArrayList<String>();
@@ -201,6 +229,7 @@
}
return metaData;
+ */
}
public Collection<Class<? extends Annotation>> getAnnotationTypes()
Modified: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/WebComponentProcessor.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/WebComponentProcessor.java 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/annotation/creator/web/WebComponentProcessor.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -74,7 +74,7 @@
}
super.process(env, type);
- // @RunAs, @MultipartConfig, @SecurityConstraint
+ // @RunAs, @MultipartConfig, @ServletSecurity
AnnotationsMetaData annotations = metaData.getAnnotations();
if(annotations == null)
{
Modified: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossAnnotationMetaData.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossAnnotationMetaData.java 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossAnnotationMetaData.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -33,7 +33,7 @@
* @version $Revision: 83549 $
*/
@XmlType(name="annotationType",
- propOrder={"className", "securityConstraints", "runAs", "multipartConfig"})
+ propOrder={"className", "servletSecurity", "runAs", "multipartConfig"})
public class JBossAnnotationMetaData extends AnnotationMetaData
{
private static final long serialVersionUID = 1;
Modified: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossServletMetaData.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossServletMetaData.java 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossServletMetaData.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlType;
import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.ServletSecurityMetaData;
/**
* jboss-web/servlet metadata
@@ -31,23 +32,32 @@
* @author Scott.Stark at jboss.org
* @version $Revision: 83549 $
*/
- at XmlType(name="servletType", propOrder={"servletName", "runAsPrincipal"})
+ at XmlType(name="servletType", propOrder={"servletName", "runAsPrincipal", "servletSecurity"})
public class JBossServletMetaData extends ServletMetaData
{
private static final long serialVersionUID = 1;
private String runAsPrincipal;
+ private ServletSecurityMetaData servletSecurity;
public String getRunAsPrincipal()
{
return runAsPrincipal;
}
-
public void setRunAsPrincipal(String runAsPrincipal)
{
this.runAsPrincipal = runAsPrincipal;
}
+ public ServletSecurityMetaData getServletSecurity()
+ {
+ return servletSecurity;
+ }
+ public void setServletSecurity(ServletSecurityMetaData servletSecurity)
+ {
+ this.servletSecurity = servletSecurity;
+ }
+
public JBossServletMetaData merge(ServletMetaData original)
{
JBossServletMetaData merged = new JBossServletMetaData();
@@ -59,5 +69,7 @@
super.merge(override, original);
if(override != null && override.runAsPrincipal != null)
setRunAsPrincipal(override.runAsPrincipal);
+ if(override != null && override.servletSecurity != null)
+ setServletSecurity(override.servletSecurity);
}
}
Modified: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -28,6 +28,7 @@
import java.util.Map;
import java.util.Set;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
@@ -70,6 +71,7 @@
import org.jboss.metadata.web.spec.ErrorPageMetaData;
import org.jboss.metadata.web.spec.FilterMappingMetaData;
import org.jboss.metadata.web.spec.FiltersMetaData;
+import org.jboss.metadata.web.spec.HttpMethodConstraintMetaData;
import org.jboss.metadata.web.spec.JspConfigMetaData;
import org.jboss.metadata.web.spec.ListenerMetaData;
import org.jboss.metadata.web.spec.LocaleEncodingsMetaData;
@@ -79,6 +81,7 @@
import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
import org.jboss.metadata.web.spec.ServletMappingMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.ServletSecurityMetaData;
import org.jboss.metadata.web.spec.ServletsMetaData;
import org.jboss.metadata.web.spec.SessionConfigMetaData;
import org.jboss.metadata.web.spec.Web25MetaData;
@@ -226,6 +229,7 @@
{
return version;
}
+ @XmlAttribute
public void setVersion(String version)
{
this.version = version;
@@ -1124,7 +1128,37 @@
multipartConfig.augment(annotation.getMultipartConfig(), null, true);
servlet.setMultipartConfig(multipartConfig);
}
- // Merge @ServletConstraint
+ // Merge @ServletSecurity
+ if (annotation.getServletSecurity() != null && servlet.getServletSecurity() == null)
+ {
+ ServletSecurityMetaData servletSecurityAnnotation = annotation.getServletSecurity();
+ ServletSecurityMetaData servletSecurity = new ServletSecurityMetaData();
+ servletSecurity.setEmptyRoleSemantic(servletSecurityAnnotation.getEmptyRoleSemantic());
+ servletSecurity.setTransportGuarantee(servletSecurityAnnotation.getTransportGuarantee());
+ List<String> roleNames = new ArrayList<String>();
+ roleNames.addAll(servletSecurityAnnotation.getRolesAllowed());
+ servletSecurity.setRolesAllowed(roleNames);
+ if (servletSecurityAnnotation.getHttpMethodConstraints() != null)
+ {
+ List<HttpMethodConstraintMetaData> methodConstraints =
+ new ArrayList<HttpMethodConstraintMetaData>();
+ for (HttpMethodConstraintMetaData annotationMethodConstraint :
+ servletSecurityAnnotation.getHttpMethodConstraints())
+ {
+ HttpMethodConstraintMetaData methodConstraint = new HttpMethodConstraintMetaData();
+ methodConstraint.setMethod(annotationMethodConstraint.getMethod());
+ methodConstraint.setEmptyRoleSemantic(annotationMethodConstraint.getEmptyRoleSemantic());
+ methodConstraint.setTransportGuarantee(annotationMethodConstraint.getTransportGuarantee());
+ roleNames = new ArrayList<String>();
+ roleNames.addAll(annotationMethodConstraint.getRolesAllowed());
+ methodConstraint.setRolesAllowed(roleNames);
+ methodConstraints.add(methodConstraint);
+ }
+ servletSecurity.setHttpMethodConstraints(methodConstraints);
+ }
+ servlet.setServletSecurity(servletSecurity);
+ }
+ /*
HashSet<String> urlPatterns = new HashSet<String>();
for (ServletMappingMetaData servletMapping : servletMappings)
{
@@ -1157,10 +1191,10 @@
}
}
}
+ */
+
}
}
- // Now add the final security constraints
- // FIXME: merge according to the spec rules, which are undefined
}
}
}
Modified: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/AnnotationMetaData.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/AnnotationMetaData.java 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/AnnotationMetaData.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -21,8 +21,6 @@
*/
package org.jboss.metadata.web.spec;
-import java.util.List;
-
import org.jboss.metadata.javaee.spec.RunAsMetaData;
import org.jboss.metadata.javaee.support.NamedMetaData;
@@ -36,10 +34,7 @@
{
private static final long serialVersionUID = 1;
- // FIXME: remove if no instance annotations
- private String servletName;
-
- private List<SecurityConstraintMetaData> securityConstraints;
+ private ServletSecurityMetaData servletSecurity;
private RunAsMetaData runAs;
private MultipartConfigMetaData multipartConfig;
@@ -52,13 +47,13 @@
setName(className);
}
- public List<SecurityConstraintMetaData> getSecurityConstraints()
+ public ServletSecurityMetaData getServletSecurity()
{
- return securityConstraints;
+ return servletSecurity;
}
- public void setSecurityConstraints(List<SecurityConstraintMetaData> securityConstraints)
+ public void setServletSecurity(ServletSecurityMetaData servletSecurity)
{
- this.securityConstraints = securityConstraints;
+ this.servletSecurity = servletSecurity;
}
public RunAsMetaData getRunAs()
{
Added: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/EmptyRoleSemanticType.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/EmptyRoleSemanticType.java (rev 0)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/EmptyRoleSemanticType.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.web.spec;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ * Empty role semantic type
+ * @author Remy Maucherat
+ * @version $Revision: 65928 $
+ */
+ at XmlEnum(String.class)
+public enum EmptyRoleSemanticType
+{
+ PERMIT, DENY
+}
Added: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpConstraintMetaData.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpConstraintMetaData.java (rev 0)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpConstraintMetaData.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.web.spec;
+
+import java.util.List;
+
+import org.jboss.metadata.javaee.support.IdMetaDataImpl;
+
+/**
+ * Models per servlet or per servlet type HTTP constraint
+ *
+ * @author Remy Maucherat
+ * @version $Revision: 81768 $
+ */
+public abstract class HttpConstraintMetaData extends IdMetaDataImpl
+{
+ private static final long serialVersionUID = 1;
+
+ private EmptyRoleSemanticType emptyRoleSemantic;
+ private TransportGuaranteeType transportGuarantee;
+ private List<String> rolesAllowed;
+
+ public EmptyRoleSemanticType getEmptyRoleSemantic()
+ {
+ return emptyRoleSemantic;
+ }
+ public void setEmptyRoleSemantic(EmptyRoleSemanticType emptyRoleSemantic)
+ {
+ this.emptyRoleSemantic = emptyRoleSemantic;
+ }
+ public TransportGuaranteeType getTransportGuarantee()
+ {
+ return transportGuarantee;
+ }
+ public void setTransportGuarantee(TransportGuaranteeType transportGuarantee)
+ {
+ this.transportGuarantee = transportGuarantee;
+ }
+ public List<String> getRolesAllowed()
+ {
+ return rolesAllowed;
+ }
+ public void setRolesAllowed(List<String> rolesAllowed)
+ {
+ this.rolesAllowed = rolesAllowed;
+ }
+
+}
Added: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpMethodConstraintMetaData.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpMethodConstraintMetaData.java (rev 0)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/HttpMethodConstraintMetaData.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.web.spec;
+
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * Models per servlet or per servlet type HTTP method constraint
+ *
+ * @author Remy Maucherat
+ * @version $Revision: 81768 $
+ */
+ at XmlType(name="http-method-constraintType",
+ propOrder={"method", "emptyRoleSemantic", "transportGuarantee", "rolesAllowed"})
+public class HttpMethodConstraintMetaData extends HttpConstraintMetaData
+{
+ private static final long serialVersionUID = 1;
+
+ private String method;
+
+ public String getMethod()
+ {
+ return method;
+ }
+ public void setMethod(String method)
+ {
+ this.method = method;
+ }
+
+}
Added: projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/ServletSecurityMetaData.java
===================================================================
--- projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/ServletSecurityMetaData.java (rev 0)
+++ projects/metadata/web/trunk/src/main/java/org/jboss/metadata/web/spec/ServletSecurityMetaData.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.web.spec;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Models per servlet or per servlet type constraints
+ *
+ * @author Remy Maucherat
+ * @version $Revision: 81768 $
+ */
+ at XmlType(name="servlet-securityType",
+ propOrder={"emptyRoleSemantic", "transportGuarantee", "rolesAllowed", "httpMethodConstraints"})
+public class ServletSecurityMetaData extends HttpConstraintMetaData
+{
+ private static final long serialVersionUID = 1;
+
+ private List<HttpMethodConstraintMetaData> httpMethodConstraints;
+
+ public List<HttpMethodConstraintMetaData> getHttpMethodConstraints()
+ {
+ return httpMethodConstraints;
+ }
+ @XmlElement(name="http-method-constraint")
+ public void setHttpMethodConstraints(
+ List<HttpMethodConstraintMetaData> httpMethodConstraints)
+ {
+ this.httpMethodConstraints = httpMethodConstraints;
+ }
+
+}
Modified: projects/metadata/web/trunk/src/main/resources/schema/jboss-web_6_0.xsd
===================================================================
--- projects/metadata/web/trunk/src/main/resources/schema/jboss-web_6_0.xsd 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/main/resources/schema/jboss-web_6_0.xsd 2009-10-09 14:35:48 UTC (rev 94603)
@@ -543,6 +543,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
+ <xsd:element name="servlet-security" type="jboss:servlet-securityType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
@@ -660,7 +661,7 @@
<![CDATA[
The annotation element specifies annotation specific bindings. This allows
- overriding the @SecurityConstraint, @RunAs and @MultipartConfig, which apply
+ overriding the @ServletSecurity, @RunAs and @MultipartConfig, which apply
a a Servlet class rather than a Servlet name.
]]>
@@ -668,7 +669,7 @@
</xsd:annotation>
<xsd:sequence>
<xsd:element name="class-name" type="javaee:string"/>
- <xsd:element name="security-constraint" type="jboss:security-constraintType" minOccurs="0"/>
+ <xsd:element name="servlet-security" type="jboss:servlet-securityType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="run-as" type="jboss:run-asType" minOccurs="0" maxOccurs="1"/>
<xsd:element name="multipart-config" type="jboss:multipart-configType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
@@ -676,41 +677,38 @@
<xsd:complexType name="run-asType">
<xsd:sequence>
+ <xsd:element name="description" type="javaee:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="role-name" type="javaee:string"/>
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="security-constraintType">
+ <xsd:complexType name="servlet-securityType">
<xsd:sequence>
- <xsd:element name="web-resource-collection" type="jboss:web-resource-collectionType" maxOccurs="unbounded"/>
- <xsd:element name="auth-constraint" type="jboss:auth-constraintType" minOccurs="0"/>
- <xsd:element name="user-data-constraint" type="jboss:user-data-constraintType" minOccurs="0"/>
+ <xsd:element name="empty-role-semantic" type="javaee:string"/>
+ <xsd:element name="transport-guarantee" type="javaee:transport-guaranteeType"/>
+ <xsd:element name="roles-allowed" type="javaee:role-nameType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="http-method-constraint" type="jboss:http-method-constraintType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
- </xsd:complexType>
+ </xsd:complexType>
- <xsd:complexType name="web-resource-collectionType">
+ <xsd:complexType name="http-method-constraintType">
<xsd:sequence>
- <xsd:element name="web-resource-name" type="javaee:string" />
- <xsd:element name="url-pattern" type="javaee:url-patternType" maxOccurs="unbounded"/>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="http-method" type="javaee:http-methodType" minOccurs="1" maxOccurs="unbounded"/>
- <xsd:element name="http-method-omission" type="javaee:http-methodType" minOccurs="1" maxOccurs="unbounded"/>
- </xsd:choice>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="auth-constraintType">
- <xsd:sequence>
- <xsd:element name="role-name" type="javaee:role-nameType" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="user-data-constraintType">
- <xsd:sequence>
+ <xsd:element name="method" type="javaee:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="empty-role-semantic" type="jboss:empty-role-semanticType"/>
<xsd:element name="transport-guarantee" type="javaee:transport-guaranteeType"/>
+ <xsd:element name="roles-allowed" type="javaee:role-nameType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
- </xsd:complexType>
+ </xsd:complexType>
+ <xsd:complexType name="empty-role-semanticType">
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="PERMIT"/>
+ <xsd:enumeration value="DENY"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
<xsd:complexType name="multipart-configType">
<xsd:sequence>
<xsd:element name="location" type="javaee:string" minOccurs="0" maxOccurs="1"/>
Deleted: projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb51BindingUnitTestCase.java
===================================================================
--- projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb51BindingUnitTestCase.java 2009-10-09 14:30:22 UTC (rev 94602)
+++ projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb51BindingUnitTestCase.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.metadata.binding;
-
-
-import org.jboss.metadata.web.jboss.JBoss50WebMetaData;
-
-/**
- * A JBossWeb51BindingUnitTestCase.
- *
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
-public class JBossWeb51BindingUnitTestCase extends SchemaBindingValidationTest
-{
- public JBossWeb51BindingUnitTestCase(String name)
- {
- super(name);
- }
-
- public void configureLogging()
- {
- super.configureLogging();
- //enableTrace(getClass().getName());
- }
-
- public void setUp() throws Exception
- {
- super.setUp();
-
- // not used in this schema
- //ignoreType(new QName(JavaEEMetaDataConstants.JBOSS_NS, "webservice-descriptionType"));
- }
-
- public void testJBossWeb51() throws Exception
- {
- assertEquivalent("jboss-web_5_1.xsd", JBoss50WebMetaData.class);
- }
-}
Copied: projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb60BindingUnitTestCase.java (from rev 92074, projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb51BindingUnitTestCase.java)
===================================================================
--- projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb60BindingUnitTestCase.java (rev 0)
+++ projects/metadata/web/trunk/src/test/java/org/jboss/test/metadata/binding/JBossWeb60BindingUnitTestCase.java 2009-10-09 14:35:48 UTC (rev 94603)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.metadata.binding;
+
+
+import org.jboss.metadata.web.jboss.JBoss60WebMetaData;
+
+/**
+ * A JBossWeb60BindingUnitTestCase.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class JBossWeb60BindingUnitTestCase extends SchemaBindingValidationTest
+{
+ public JBossWeb60BindingUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void configureLogging()
+ {
+ super.configureLogging();
+ //enableTrace(getClass().getName());
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ // not used in this schema
+ //ignoreType(new QName(JavaEEMetaDataConstants.JBOSS_NS, "webservice-descriptionType"));
+ }
+
+ public void testJBossWeb60() throws Exception
+ {
+ assertEquivalent("jboss-web_6_0.xsd", JBoss60WebMetaData.class);
+ }
+}
More information about the jboss-cvs-commits
mailing list