Package javax.servlet

Examples of javax.servlet.HttpConstraintElement


                            if (servletSecurityAnnotation.getTransportGuarantee() != null) {
                                transportGuarantee = TransportGuarantee.valueOf(servletSecurityAnnotation
                                        .getTransportGuarantee().toString());
                            }
                            String[] roleNames = servletSecurityAnnotation.getRolesAllowed().toArray(new String[0]);
                            HttpConstraintElement constraint = new HttpConstraintElement(emptyRoleSemantic, transportGuarantee,
                                    roleNames);

                            if (servletSecurityAnnotation.getHttpMethodConstraints() != null) {
                                methodConstraints = new HashSet<HttpMethodConstraintElement>();
                                for (HttpMethodConstraintMetaData annotationMethodConstraint : servletSecurityAnnotation
                                        .getHttpMethodConstraints()) {
                                    emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
                                    if (annotationMethodConstraint.getEmptyRoleSemantic() != null) {
                                        emptyRoleSemantic = EmptyRoleSemantic.valueOf(annotationMethodConstraint
                                                .getEmptyRoleSemantic().toString());
                                    }
                                    transportGuarantee = TransportGuarantee.NONE;
                                    if (annotationMethodConstraint.getTransportGuarantee() != null) {
                                        transportGuarantee = TransportGuarantee.valueOf(annotationMethodConstraint
                                                .getTransportGuarantee().toString());
                                    }
                                    roleNames = annotationMethodConstraint.getRolesAllowed().toArray(new String[0]);
                                    HttpConstraintElement constraint2 = new HttpConstraintElement(emptyRoleSemantic,
                                            transportGuarantee, roleNames);
                                    HttpMethodConstraintElement methodConstraint = new HttpMethodConstraintElement(
                                            annotationMethodConstraint.getMethod(), constraint2);
                                    methodConstraints.add(methodConstraint);
                                }
View Full Code Here


            Servlet s = new Bug50015Servlet();
            ServletRegistration.Dynamic sr = ctx.addServlet("bug50015", s);
            sr.addMapping("/bug50015");
           
            // Limit access to users in the Tomcat role
            HttpConstraintElement hce = new HttpConstraintElement(
                    TransportGuarantee.NONE, "tomcat");
            ServletSecurityElement sse = new ServletSecurityElement(hce);
            sr.setServletSecurity(sse);
        }
View Full Code Here

                            if (servletSecurityAnnotation.getTransportGuarantee() != null) {
                                transportGuarantee = TransportGuarantee.valueOf(servletSecurityAnnotation
                                        .getTransportGuarantee().toString());
                            }
                            String[] roleNames = servletSecurityAnnotation.getRolesAllowed().toArray(new String[0]);
                            HttpConstraintElement constraint = new HttpConstraintElement(emptyRoleSemantic, transportGuarantee,
                                    roleNames);

                            if (servletSecurityAnnotation.getHttpMethodConstraints() != null) {
                                methodConstraints = new HashSet<HttpMethodConstraintElement>();
                                for (HttpMethodConstraintMetaData annotationMethodConstraint : servletSecurityAnnotation
                                        .getHttpMethodConstraints()) {
                                    emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
                                    if (annotationMethodConstraint.getEmptyRoleSemantic() != null) {
                                        emptyRoleSemantic = EmptyRoleSemantic.valueOf(annotationMethodConstraint
                                                .getEmptyRoleSemantic().toString());
                                    }
                                    transportGuarantee = TransportGuarantee.NONE;
                                    if (annotationMethodConstraint.getTransportGuarantee() != null) {
                                        transportGuarantee = TransportGuarantee.valueOf(annotationMethodConstraint
                                                .getTransportGuarantee().toString());
                                    }
                                    roleNames = annotationMethodConstraint.getRolesAllowed().toArray(new String[0]);
                                    HttpConstraintElement constraint2 = new HttpConstraintElement(emptyRoleSemantic,
                                            transportGuarantee, roleNames);
                                    HttpMethodConstraintElement methodConstraint = new HttpMethodConstraintElement(
                                            annotationMethodConstraint.getMethod(), constraint2);
                                    methodConstraints.add(methodConstraint);
                                }
View Full Code Here

            Servlet s = new TesterServlet();
            ServletRegistration.Dynamic sr = ctx.addServlet("bug50015", s);
            sr.addMapping("/bug50015");

            // Limit access to users in the Tomcat role
            HttpConstraintElement hce = new HttpConstraintElement(
                    TransportGuarantee.NONE, "tomcat");
            ServletSecurityElement sse = new ServletSecurityElement(hce);
            sr.setServletSecurity(sse);
        }
View Full Code Here

            Servlet s = new TesterServlet();
            ServletRegistration.Dynamic sr = ctx.addServlet("test", s);
            sr.addMapping("/test");

            // Add a constraint with uncovered methods
            HttpConstraintElement hce = new HttpConstraintElement(
                    TransportGuarantee.NONE, "tomcat");
            HttpMethodConstraintElement hmce =
                    new HttpMethodConstraintElement("POST", hce);
            Set<HttpMethodConstraintElement> hmces = new HashSet<>();
            hmces.add(hmce);
View Full Code Here

            Servlet s = new Bug50015Servlet();
            ServletRegistration.Dynamic sr = ctx.addServlet("bug50015", s);
            sr.addMapping("/bug50015");

            // Limit access to users in the Tomcat role
            HttpConstraintElement hce = new HttpConstraintElement(
                    TransportGuarantee.NONE, "tomcat");
            ServletSecurityElement sse = new ServletSecurityElement(hce);
            sr.setServletSecurity(sse);
        }
View Full Code Here

                            if (servletSecurityAnnotation.getTransportGuarantee() != null) {
                                transportGuarantee = TransportGuarantee.valueOf(servletSecurityAnnotation
                                        .getTransportGuarantee().toString());
                            }
                            String[] roleNames = servletSecurityAnnotation.getRolesAllowed().toArray(new String[0]);
                            HttpConstraintElement constraint = new HttpConstraintElement(emptyRoleSemantic, transportGuarantee,
                                    roleNames);

                            if (servletSecurityAnnotation.getHttpMethodConstraints() != null) {
                                methodConstraints = new HashSet<HttpMethodConstraintElement>();
                                for (HttpMethodConstraintMetaData annotationMethodConstraint : servletSecurityAnnotation
                                        .getHttpMethodConstraints()) {
                                    emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
                                    if (annotationMethodConstraint.getEmptyRoleSemantic() != null) {
                                        emptyRoleSemantic = EmptyRoleSemantic.valueOf(annotationMethodConstraint
                                                .getEmptyRoleSemantic().toString());
                                    }
                                    transportGuarantee = TransportGuarantee.NONE;
                                    if (annotationMethodConstraint.getTransportGuarantee() != null) {
                                        transportGuarantee = TransportGuarantee.valueOf(annotationMethodConstraint
                                                .getTransportGuarantee().toString());
                                    }
                                    roleNames = annotationMethodConstraint.getRolesAllowed().toArray(new String[0]);
                                    HttpConstraintElement constraint2 = new HttpConstraintElement(emptyRoleSemantic,
                                            transportGuarantee, roleNames);
                                    HttpMethodConstraintElement methodConstraint = new HttpMethodConstraintElement(
                                            annotationMethodConstraint.getMethod(), constraint2);
                                    methodConstraints.add(methodConstraint);
                                }
View Full Code Here

TOP

Related Classes of javax.servlet.HttpConstraintElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.