Package com.sun.net.httpserver

Examples of com.sun.net.httpserver.Authenticator


    List<Filter> getSystemFilters () {
        return sfilters;
    }

    public Authenticator setAuthenticator (Authenticator auth) {
        Authenticator old = authenticator;
        authenticator = auth;
        authfilter.setAuthenticator (auth);
        return old;
    }
View Full Code Here


    }

    @Override
    public Authenticator setAuthenticator(Authenticator auth)
    {
      Authenticator previous = _authenticator;
      _authenticator = auth;
        return previous;
    }
View Full Code Here

                       {
        if (!target.startsWith(getContextPath())) return;
        JettyHttpExchange jettyHttpExchange = new JettyHttpExchange(_context, req, resp);
        try
        {
            Authenticator auth = _context.getAuthenticator();

            if (auth != null)
            {
                Authenticator.Result authResult = auth.authenticate(jettyHttpExchange);
                if (authResult instanceof Authenticator.Success)
                {
                    HttpPrincipal p = ((Authenticator.Success)authResult).getPrincipal();
                    jettyHttpExchange.setPrincipal(p);
                    invokeHandler(jettyHttpExchange);
View Full Code Here

    }

    @Override
    public Authenticator setAuthenticator(Authenticator auth)
    {
      Authenticator previous = _authenticator;
      _authenticator = auth;
        return previous;
    }
View Full Code Here

        JettyHttpExchange jettyHttpExchange = new JettyHttpExchange(_context, req, resp);
       
        // TODO: add filters processing

        Authenticator auth = _context.getAuthenticator();
        try
        {
          if (auth != null)
              handleAuthentication(resp, jettyHttpExchange, auth);
          else
View Full Code Here

        // TODO: add filters processing

        try
        {
            Authenticator auth = _httpContext.getAuthenticator();
            if (auth != null)
            {
                handleAuthentication(resp,jettyHttpExchange,auth);
            }
            else
View Full Code Here

    }

    @Override
    public Authenticator setAuthenticator(Authenticator auth)
    {
        Authenticator previous = _authenticator;
        _authenticator = auth;
        return previous;
    }
View Full Code Here

        final String contextPath = pConfig.getContextPath();
        jolokiaHttpHandler = new JolokiaHttpHandler(pConfig.getJolokiaConfig());
        HttpContext context = pServer.createContext(contextPath, jolokiaHttpHandler);

        // Add authentication if configured
        final Authenticator authenticator = pConfig.getAuthenticator();
        if (authenticator != null) {
            context.setAuthenticator(authenticator);
        }

        url = detectAgentUrl(pServer, pConfig, contextPath);
View Full Code Here

    @Test
    public void readConfig() throws IOException {
        String path = copyResourceToTemp("/agent-test.properties");
        JvmAgentConfig config = new JvmAgentConfig("config=" + path);
        assertEquals(config.getProtocol(), "https");
        Authenticator authenticator = config.getAuthenticator();
        assertNotNull(authenticator);
        assertTrue(authenticator instanceof UserPasswordAuthenticator);
        assertTrue(((UserPasswordAuthenticator) authenticator).checkCredentials("roland","s!cr!t"));
    }
View Full Code Here

    @Test
    public void readConfigWithCustomAuthenticator() throws IOException {
        String path = copyResourceToTemp("/agent-custom-authenticator-test.properties");
        JvmAgentConfig config = new JvmAgentConfig("config=" + path);
        assertEquals(config.getProtocol(), "http");
        Authenticator authenticator = config.getAuthenticator();
        assertNotNull(authenticator);
        assertTrue(authenticator instanceof Dummy);
        assertSame(((Dummy)authenticator).getConfig(), config.getJolokiaConfig());
    }
View Full Code Here

TOP

Related Classes of com.sun.net.httpserver.Authenticator

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.