Package org.eclipse.jetty.util.security

Examples of org.eclipse.jetty.util.security.Constraint


    conn.setHost("127.0.0.1");
    return conn;
  }

  private SecurityHandler makeSecurityHandler(String password) {
    Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
    constraint.setAuthenticate(true);
    constraint.setRoles(new String[]{"user"});
    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");
    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
View Full Code Here


    conn.setHost("127.0.0.1");
    return conn;
  }

  private SecurityHandler makeSecurityHandler(String password) {
    Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
    constraint.setAuthenticate(true);
    constraint.setRoles(new String[]{"user"});
    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");
    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
View Full Code Here

    final JPALoginService loginService = new JPALoginService();
    // server.addBean(loginService);

    final ConstraintSecurityHandler security = new ConstraintSecurityHandler();

    final Constraint constraint = new Constraint();
    constraint.setName(Constraint.__FORM_AUTH);
    constraint.setAuthenticate(true);
    constraint.setRoles(RoleType.names());

    final ConstraintMapping cm = new ConstraintMapping();
    cm.setPathSpec("/*");
    cm.setConstraint(constraint);

 
View Full Code Here

  /**
   * Initialize the handler context and other related services.
   */
  public void init() throws Exception {
    Constraint constraint = new Constraint();
    constraint.setRoles(new String[]{"*"});
    constraint.setAuthenticate(true);

    if (configuration.getBoolean(Constants.Security.SSL_ENABLED)) {
      constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
    }

    ConstraintMapping constraintMapping = new ConstraintMapping();
    constraintMapping.setConstraint(constraint);
    constraintMapping.setPathSpec("/*");
 
View Full Code Here

  private ConstraintSecurityHandler createSecurityHandler(Server server,
      ServletDefinition servletDefinition) {
    ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
    securityHandler.setServer(server);

    Constraint constraint = new Constraint();
    constraint.setName("security" + servletDefinition.hashCode());

    if (servletDefinition.isRequireBasicAuth()) {
      // add basic authentication and role-based authorization based on
      // the credentials store (realm file)
      LoginService loginService = new HashLoginService(
          "elastisys:scale security realm",
          servletDefinition.getRealmFile());
      securityHandler.getServer().addBean(loginService);
      securityHandler.setAuthenticator(new BasicAuthenticator());
      securityHandler.setLoginService(loginService);
      constraint.setAuthenticate(true);
      constraint.setRoles(new String[] { servletDefinition
          .getRequireRole() });
    }

    // require confidential transport: HTTP requests will be redirected to
    // the secure (https) port.
    if (servletDefinition.isRequireHttps()) {
      constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
    }

    // apply constraint to all pages/web resources
    ConstraintMapping mapping = new ConstraintMapping();
    mapping.setConstraint(constraint);
View Full Code Here

        JndiRegistry jndi = super.createRegistry();
        jndi.bind("myAuthHandler", getSecurityHandler());
        return jndi;
    }
    private SecurityHandler getSecurityHandler() throws IOException {
        Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
        constraint.setAuthenticate(true);

        ConstraintMapping cm = new ConstraintMapping();
        cm.setPathSpec("/*");
        cm.setConstraint(constraint);

View Full Code Here

        jndi.bind("myAuthHandler", getSecurityHandler());
        return jndi;
    }

    private SecurityHandler getSecurityHandler() throws IOException {
        Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
        constraint.setAuthenticate(true);

        ConstraintMapping cm = new ConstraintMapping();
        cm.setPathSpec("/*");
        cm.setConstraint(constraint);

View Full Code Here

        jndi.bind("myAuthHandler", getSecurityHandler());
        return jndi;
    }

    private SecurityHandler getSecurityHandler() throws IOException {
        Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
        constraint.setAuthenticate(true);

        ConstraintMapping cm = new ConstraintMapping();
        cm.setPathSpec("/*");
        cm.setConstraint(constraint);

View Full Code Here

    // redirect HTTP requests to HTTPS
    if (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) {
      logger.info(String.format("Configuring automatic http(%1$s) -> https(%2$s) redirects", params.port, params.securePort));
      // Create the internal mechanisms to handle secure connections and redirects
      Constraint constraint = new Constraint();
      constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);

      ConstraintMapping cm = new ConstraintMapping();
      cm.setConstraint(constraint);
      cm.setPathSpec("/*");

 
View Full Code Here

        // Increase form size.
        context.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;

        // Wire up authentication if appropriate
        if ( jettyConfig == null && serverConfig.authConfigFile != null ) {
            Constraint constraint = new Constraint() ;
            constraint.setName(Constraint.__BASIC_AUTH) ;
            constraint.setRoles(new String[]{"fuseki"}) ;
            constraint.setAuthenticate(true) ;

            ConstraintMapping mapping = new ConstraintMapping() ;
            mapping.setConstraint(constraint) ;
            mapping.setPathSpec("/*") ;

View Full Code Here

TOP

Related Classes of org.eclipse.jetty.util.security.Constraint

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.