Java Code Examples for javax.servlet.annotation.ServletSecurity.TransportGuarantee#NONE

The following examples show how to use javax.servlet.annotation.ServletSecurity.TransportGuarantee#NONE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestStandardContext.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx)
        throws ServletException {
    // Register and map servlet
    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);
    ServletSecurityElement sse = new ServletSecurityElement(hmces);
    sr.setServletSecurity(sse);
}
 
Example 2
Source File: HttpConstraintElement.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
 
Example 3
Source File: TestStandardContext.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx)
        throws ServletException {
    // Register and map servlet
    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);
}
 
Example 4
Source File: HttpConstraintElement.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
 
Example 5
Source File: TestStandardContext.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx)
        throws ServletException {
    // Register and map servlet
    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);
}
 
Example 6
Source File: HttpConstraintElement.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
 
Example 7
Source File: TestStandardContext.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx)
        throws ServletException {
    // Register and map servlet
    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);
}
 
Example 8
Source File: HttpConstraintElement.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * Convenience constructor for {@link EmptyRoleSemantic#DENY}.
 * 
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
 
Example 9
Source File: HttpConstraintElement.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * Convenience constructor for {@link EmptyRoleSemantic#DENY}.
 * 
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
 
Example 10
Source File: HttpConstraintElement.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Construct a constraint with an empty role semantic. Typically used with
 * {@link EmptyRoleSemantic#DENY}.
 *
 * @param emptyRoleSemantic The empty role semantic to apply to the newly
 *                          created constraint
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
 
Example 11
Source File: HttpConstraintElement.java    From piranha with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Constructor.
 *
 * @param emptyRoleSemantic the EmptyRoleSemantic.
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
    this(emptyRoleSemantic, TransportGuarantee.NONE, new String[0]);
}
 
Example 12
Source File: HttpConstraintElement.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convenience constructor to establish <tt>EmptyRoleSemantic.DENY</tt>
 *
 * @param semantic should be EmptyRoleSemantic.DENY
 */
public HttpConstraintElement(EmptyRoleSemantic semantic) {
    this(semantic, TransportGuarantee.NONE, new String[0]);
}