Package org.springframework.security.web.authentication.www

Examples of org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint


    public final void setUp() throws Exception {
        super.setUp();
    }

    public void testDetectsMissingRealmName() throws Exception {
        BasicAuthenticationEntryPoint ep = new BasicAuthenticationEntryPoint();

        try {
            ep.afterPropertiesSet();
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertEquals("realmName must be specified", expected.getMessage());
        }
    }
View Full Code Here


            assertEquals("realmName must be specified", expected.getMessage());
        }
    }

    public void testGettersSetters() {
        BasicAuthenticationEntryPoint ep = new BasicAuthenticationEntryPoint();
        ep.setRealmName("realm");
        assertEquals("realm", ep.getRealmName());
    }
View Full Code Here

        ep.setRealmName("realm");
        assertEquals("realm", ep.getRealmName());
    }

    public void testNormalOperation() throws Exception {
        BasicAuthenticationEntryPoint ep = new BasicAuthenticationEntryPoint();

        ep.setRealmName("hello");

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRequestURI("/some_path");

        MockHttpServletResponse response = new MockHttpServletResponse();

        //ep.afterPropertiesSet();

        String msg = "These are the jokes kid";
        ep.commence(request, response, new DisabledException(msg));

        assertEquals(401, response.getStatus());
        assertEquals(msg, response.getErrorMessage());

        assertEquals("Basic realm=\"hello\"", response.getHeader("WWW-Authenticate"));
View Full Code Here

    final RequestMatcher textHtmlMatcher = new MediaTypeRequestMatcher(contentNegotiationStrategy,
        MediaType.TEXT_HTML);

    final String loginPage = "/admin-ui/login";

    BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint();
    basicAuthenticationEntryPoint.setRealmName(realm);
    basicAuthenticationEntryPoint.afterPropertiesSet();

    http.csrf().disable()
        .authorizeRequests()
        .antMatchers("/admin-ui/styles/**").permitAll()
        .antMatchers("/admin-ui/images/**").permitAll()
 
View Full Code Here

      }

    }

    private AuthenticationEntryPoint entryPoint() {
      BasicAuthenticationEntryPoint entryPoint = new BasicAuthenticationEntryPoint();
      entryPoint.setRealmName(this.security.getBasic().getRealm());
      return entryPoint;
    }
View Full Code Here

      }
      return list.toArray(new String[list.size()]);
    }

    private AuthenticationEntryPoint entryPoint() {
      BasicAuthenticationEntryPoint entryPoint = new BasicAuthenticationEntryPoint();
      entryPoint.setRealmName(this.security.getBasic().getRealm());
      return entryPoint;
    }
View Full Code Here

     *            the HTTP Basic realm to use
     * @return {@link HttpBasicConfigurer} for additional customization
     * @throws Exception
     */
    public HttpBasicConfigurer<B> realmName(String realmName) throws Exception {
        BasicAuthenticationEntryPoint basicAuthEntryPoint = new BasicAuthenticationEntryPoint();
        basicAuthEntryPoint.setRealmName(realmName);
        basicAuthEntryPoint.afterPropertiesSet();
        return authenticationEntryPoint(basicAuthEntryPoint);
    }
View Full Code Here

        super.initializeFromConfig(config);

        GeoFenceAuthFilterConfig cfg = (GeoFenceAuthFilterConfig) config;
        // anything to set here? maybe the cache config

        aep= new BasicAuthenticationEntryPoint();
        aep.setRealmName(GeoServerSecurityManager.REALM);


        try {
            aep.afterPropertiesSet();
View Full Code Here

        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException("No MD5 algorithm available!");
        }

       
        aep= new BasicAuthenticationEntryPoint();
        aep.setRealmName(GeoServerSecurityManager.REALM);
        try {
            aep.afterPropertiesSet();
        } catch (Exception e) {
            throw new IOException(e);
View Full Code Here

TOP

Related Classes of org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint

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.