@Override public boolean equals(Object t) { if (t == null || (!(t instanceof SecurityConstraintConfig))) return false; SecurityConstraintConfig _t = (SecurityConstraintConfig) t; return (roleNames.containsAll(_t.roleNames) && webResourceCollections.equals(_t.webResourceCollections) && transportGuarantee.equals(_t.transportGuarantee)); }
private SecurityConstraintInfo newSecurityConstraint(String[] rolesAllowed, TransportGuarantee transportGuarantee, ServletSecurity.EmptyRoleSemantic emptyRoleSemantic, boolean force) { //IF emptyRoleSemantic=PERMIT AND rolesAllowed={} AND transportGuarantee=NONE then // No Constraint //END IF if (force || rolesAllowed.length > 0 || transportGuarantee.equals(TransportGuarantee.CONFIDENTIAL) || emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY)) { SecurityConstraintInfo securityConstraint = new SecurityConstraintInfo(); WebResourceCollectionInfo webResourceCollection = new WebResourceCollectionInfo(); securityConstraint.webResourceCollections.add(webResourceCollection); if (transportGuarantee.equals(TransportGuarantee.CONFIDENTIAL)) { securityConstraint.userDataConstraint = TransportGuarantee.CONFIDENTIAL.name(); } if (emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.DENY)) { securityConstraint.authConstraint = new AuthConstraintInfo(); } else if (rolesAllowed.length > 0) { //When rolesAllowed.length == 0 and emptyRoleSemantic.equals(ServletSecurity.EmptyRoleSemantic.PERMIT), no need to create the AuthConstraint object, as it means deny all AuthConstraintInfo authConstraint = new AuthConstraintInfo(); for (String roleAllowed : rolesAllowed) { authConstraint.roleNames.add(roleAllowed); } securityConstraint.authConstraint = authConstraint; } return securityConstraint; } return null; }
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))
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))
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;
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;
void addHttpMethodConstraint(String httpMethod, List<String> rolesAllowed, TransportGuarantee transportGuarantee, EmptyRoleSemantic emptyRoleSemantic) { if (TransportGuarantee.CONFIDENTIAL.equals(transportGuarantee)) { if (httpMethodConstraintInfo_confidential == null) { httpMethodConstraintInfo_confidential = new HttpMethodConstraintInfo(transportGuarantee); httpMethodConstraintInfo_confidential.process(httpMethod, rolesAllowed, emptyRoleSemantic); } } else { // NONE if (httpMethodConstraintInfo_none == null) { httpMethodConstraintInfo_none = new HttpMethodConstraintInfo(TransportGuarantee.NONE); httpMethodConstraintInfo_none.process(httpMethod, rolesAllowed, emptyRoleSemantic); } } }
constraint.setDataConstraint((transport.equals(TransportGuarantee.CONFIDENTIAL)?Constraint.DC_CONFIDENTIAL:Constraint.DC_NONE)); return constraint;