Package org.eclipse.jetty.security.authentication

Examples of org.eclipse.jetty.security.authentication.BasicAuthenticator


                mapping0
                                                                            }));
        DefaultIdentityService identityService = new DefaultIdentityService();
        _security.setLoginService(new CustomLoginService(identityService));
        _security.setIdentityService(identityService);
        _security.setAuthenticator(new BasicAuthenticator());
        _server.start();

        String response;

        response = _connector.getResponses("GET /ctx/confid/info HTTP/1.0\r\n\r\n");
View Full Code Here


                mapping0
                                                                            }));
        DefaultIdentityService identityService = new DefaultIdentityService();
        _security.setLoginService(new CustomLoginService(identityService));
        _security.setIdentityService(identityService);
        _security.setAuthenticator(new BasicAuthenticator());
        _server.start();

        String response;

        response = _connector.getResponses("GET /ctx/restricted/info HTTP/1.0\r\n\r\n");
View Full Code Here

    }

    @Test
    public void testUncoveredHttpMethodDetection() throws Exception
    {
        _security.setAuthenticator(new BasicAuthenticator());
        _server.start();

       Set<String> paths =  _security.getPathsWithUncoveredHttpMethods();
       assertEquals(1, paths.size());
       assertEquals("/*", paths.iterator().next());
View Full Code Here

        super(sslContextFactory);
    }

    public void startBasic(Handler handler) throws Exception
    {
        start(new BasicAuthenticator(), handler);
    }
View Full Code Here

    return ctx;
  }

  public ServletContextHandler authBasic(ServletContextHandler ctx) {
    assertNotYetSetUp();
    auth(ctx, new BasicAuthenticator());
    return ctx;
  }
View Full Code Here

        // constraint mappings as you like so long as they follow the mapping
        // requirements of the servlet api. Next we set a BasicAuthenticator
        // instance which is the object that actually checks the credentials
        // followed by the LoginService which is the store of known users, etc.
        security.setConstraintMappings(Collections.singletonList(mapping));
        security.setAuthenticator(new BasicAuthenticator());
        security.setLoginService(loginService);

        // The Hello Handler is the handler we are securing so we create one,
        // and then set it as the handler on the
        // security handler to complain the simple handler chain.
View Full Code Here

        Set<String> knownRoles = new HashSet<>();
        knownRoles.add("user");
        knownRoles.add("admin");

        security.setConstraintMappings(Collections.singletonList(mapping), knownRoles);
        security.setAuthenticator(new BasicAuthenticator());
        security.setLoginService(_loginService);

        ServletContextHandler root = new ServletContextHandler();
        root.setContextPath("/");
        root.setResourceBase(_resourceBase);
View Full Code Here

    private SecurityHandler getSecurityHandler(String pUser, String pPassword, String pRole) {
      HashLoginService loginService = getLoginService(pUser, pPassword, pRole);
      server.addBean(loginService);         
      ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
      securityHandler.setConstraintMappings(getConstraintMappings(pRole));
      securityHandler.setAuthenticator(new BasicAuthenticator());
      securityHandler.addBean(loginService);
        return securityHandler;
    }
View Full Code Here

    constraint.setRoles(new String[] { "user", "admin" });
    ConstraintMapping mapping = new ConstraintMapping();
    mapping.setPathSpec( "/*" );
    mapping.setConstraint( constraint );
    securityHandler.setConstraintMappings(Collections.singletonList(mapping));
    securityHandler.setAuthenticator(new BasicAuthenticator());
    securityHandler.setLoginService(loginService);

    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setDirectoriesListed(false);
    resourceHandler.setWelcomeFiles(new String[]{"main.html"});
View Full Code Here

    return ctx;
  }

  public ServletContextHandler authBasic(ServletContextHandler ctx) {
    assertNotYetSetUp();
    auth(ctx, new BasicAuthenticator());
    return ctx;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.security.authentication.BasicAuthenticator

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.