Package org.eclipse.jetty.security

Examples of org.eclipse.jetty.security.HashLoginService


        addConstraint(path, username, password);
    }

    private void buildSecurityHandlerIfNecessary() {
        if (securityHandler == null) {
            HashLoginService l = new HashLoginService();
            l.setName("realm");

            ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
            csh.setAuthenticator(new BasicAuthenticator());
            csh.setRealmName("realm");
            csh.setLoginService(l);
View Full Code Here


        }
    }

    private void addConstraint(String path, String username, String password) {
    /* Bad, evil casting :/ */
        HashLoginService l = (HashLoginService) securityHandler.getLoginService();
        l.putUser(username, Credential.getCredential(password), new String[]{"user"});

        org.eclipse.jetty.util.security.Constraint constraint = new org.eclipse.jetty.util.security.Constraint();
        constraint.setName(__BASIC_AUTH);
        constraint.setRoles(new String[]{"user"});
        constraint.setAuthenticate(true);
View Full Code Here

    /**
     * Initialize member variables if not set by user in application context.
     */
    public void afterPropertiesSet() throws Exception {
        if (loginService == null) {
            loginService = new HashLoginService();
            ((HashLoginService)loginService).setName(realm);
        }
    }
View Full Code Here

    this.port = ((ServerConnector) server.getConnectors()[0]).getLocalPort();

  }

  private ConstraintSecurityHandler newSecurityHandler(ResourceHandler handler) {
    HashLoginService login = new HashLoginService();
    login.putUser(USERNAME, Credential.getCredential(PASSWORD), new String[] { "user" });

    Constraint constraint = new Constraint();
    constraint.setName(Constraint.__BASIC_AUTH);
    constraint.setRoles(new String[] { "user" });
    constraint.setAuthenticate(true);
View Full Code Here

        server.stop();

        final String userName = "cometd";
        final String password = "cometd";
        String[] roles = {"admin"};
        HashLoginService loginService = new HashLoginService("CometD-Realm");
        loginService.putUser(userName, Credential.getCredential(password), roles);
        server.addBean(loginService);

        Handler handler = server.getHandler();
        ConstraintSecurityHandler security = new ConstraintSecurityHandler();
        server.setHandler(security);
View Full Code Here

    public HashLoginService get()
    {
        String authConfig = config.getUserAuthFile();
        try {
            if (!StringUtils.isEmpty(authConfig)) {
                HashLoginService service = new HashLoginService(HttpServerModule.REALM_NAME, authConfig);
                service.loadUsers();
                return service;
            }
            return null;
        }
        catch (IOException e) {
View Full Code Here

          + "' with the authentication information is missing. Starting server without HTTP authentication.");
        af = null;
      }
    }
    if (af != null) {
      HashLoginService loginService = new HashLoginService("Flink Query Engine Interface", authFile);
      server.addBean(loginService);

      Constraint constraint = new Constraint();
      constraint.setName(Constraint.__BASIC_AUTH);
      constraint.setAuthenticate(true);
View Full Code Here

    public HashLoginService get()
    {
        String authConfig = config.getUserAuthFile();
        try {
            if (!StringUtils.isEmpty(authConfig)) {
                HashLoginService service = new HashLoginService(HttpServerModule.REALM_NAME, authConfig);
                service.loadUsers();
                return service;
            }
            return null;
        }
        catch (IOException e) {
View Full Code Here

          + "' with the authentication information is missing. Starting server without HTTP authentication.");
        af = null;
      }
    }
    if (af != null) {
      HashLoginService loginService = new HashLoginService("Flink Jobmanager Interface", authFile);
      server.addBean(loginService);

      Constraint constraint = new Constraint();
      constraint.setName(Constraint.__BASIC_AUTH);
      constraint.setAuthenticate(true);
View Full Code Here

        constraintMapping.setConstraint(constraint);
        return constraintMapping;
    }

    protected LoginService loginService() {
        HashLoginService loginService = new HashLoginService();
        loginService.setName("DefaultRealm");
        loginService.setConfig("config/realm.properties");
        return loginService;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.security.HashLoginService

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.