boolean classPA = servletSecurity.getEmptyRoleSemantic().equals(EmptyRoleSemantic.PERMIT); boolean classDA = servletSecurity.getEmptyRoleSemantic().equals(EmptyRoleSemantic.DENY); boolean classTP = servletSecurity.getTransportGuarantee().equals(TransportGuarantee.CONFIDENTIAL); String[] classRA = servletSecurity.getRolesAllowed(); Collection<HttpMethodConstraintElement> httpMethodConstraints = boolean methodPA = httpMethodConstraint.getEmptyRoleSemantic().equals(EmptyRoleSemantic.PERMIT); boolean methodDA = httpMethodConstraint.getEmptyRoleSemantic().equals(EmptyRoleSemantic.DENY); boolean methodTP = httpMethodConstraint.getTransportGuarantee().equals(TransportGuarantee.CONFIDENTIAL); String[] methodRA = httpMethodConstraint.getRolesAllowed(); if (methodDA || methodTP || (methodRA != null && methodRA.length > 0))
return true; if (userConstraint.equals(TransportGuarantee.NONE.name())) { if (log.isDebugEnabled()) log.debug(" User data constraint has no restrictions");
for (Node iiN : iN) { if ("transport-guarantee".equalsIgnoreCase(iiN.getName())) { transportGuarantee = TransportGuarantee.valueOf(StringUtils.clean2(iiN.getContent()));
boolean classPA = servletSecurity.getEmptyRoleSemantic().equals(EmptyRoleSemantic.PERMIT); boolean classDA = servletSecurity.getEmptyRoleSemantic().equals(EmptyRoleSemantic.DENY); boolean classTP = servletSecurity.getTransportGuarantee().equals(TransportGuarantee.CONFIDENTIAL); String[] classRA = servletSecurity.getRolesAllowed(); Collection<HttpMethodConstraintElement> httpMethodConstraints = boolean methodPA = httpMethodConstraint.getEmptyRoleSemantic().equals(EmptyRoleSemantic.PERMIT); boolean methodDA = httpMethodConstraint.getEmptyRoleSemantic().equals(EmptyRoleSemantic.DENY); boolean methodTP = httpMethodConstraint.getTransportGuarantee().equals(TransportGuarantee.CONFIDENTIAL); String[] methodRA = httpMethodConstraint.getRolesAllowed(); if (methodDA || methodTP || (methodRA != null && methodRA.length > 0))
if (servletSecurityAnnotation.getTransportGuarantee() != null) transportGuarantee = TransportGuarantee.valueOf(servletSecurityAnnotation.getTransportGuarantee().toString()); if (annotationMethodConstraint.getTransportGuarantee() != null) transportGuarantee = TransportGuarantee.valueOf(annotationMethodConstraint.getTransportGuarantee().toString());
return true; if (userConstraint.equals(TransportGuarantee.NONE.name())) { if (log.isDebugEnabled()) log.debug(" User data constraint has no restrictions");
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
metaData.setTransportGuarantee(TransportGuaranteeType.valueOf(httpConstraint.transportGuarantee().toString())); List<String> rolesAllowed = new ArrayList<String>(); for (String role : httpConstraint.rolesAllowed()) methodConstraint.setMethod(httpMethodConstraint.value()); methodConstraint.setEmptyRoleSemantic(EmptyRoleSemanticType.valueOf(httpMethodConstraint.emptyRoleSemantic().toString())); methodConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(httpMethodConstraint.transportGuarantee().toString())); rolesAllowed = new ArrayList<String>(); for (String role : httpMethodConstraint.rolesAllowed())
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;
constraint.setUserConstraint(element.getTransportGuarantee().name()); create = true;
constraint.setUserConstraint(element.getTransportGuarantee().name()); create = true;
constraint.setUserConstraint(element.getTransportGuarantee().name()); create = true;
constraint.setUserConstraint(element.getTransportGuarantee().name()); create = true;
private static SecurityConstraint createConstraint( HttpConstraintElement element, String urlPattern, boolean alwaysCreate) { SecurityConstraint constraint = new SecurityConstraint(); SecurityCollection collection = new SecurityCollection(); boolean create = alwaysCreate; if (element.getTransportGuarantee() != ServletSecurity.TransportGuarantee.NONE) { constraint.setUserConstraint(element.getTransportGuarantee().name()); create = true; } if (element.getRolesAllowed().length > 0) { String[] roles = element.getRolesAllowed(); for (String role : roles) { constraint.addAuthRole(role); } create = true; } if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) { constraint.setAuthConstraint(true); create = true; } if (create) { collection.addPattern(urlPattern); constraint.addCollection(collection); return constraint; } return null; }