Examples of ProviderManager


Examples of org.springframework.security.authentication.ProviderManager

    }

    @Test
    public void clearCredentialsPropertyIsRespected() throws Exception {
        setContext("<authentication-manager erase-credentials='false'/>");
        ProviderManager pm = (ProviderManager) appContext.getBeansOfType(ProviderManager.class).values().toArray()[0];
        assertFalse(pm.isEraseCredentialsAfterAuthentication());
    }
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

    protected ProviderManager performBuild() throws Exception {
        if(!isConfigured()) {
            logger.debug("No authenticationProviders and no parentAuthenticationManager defined. Returning null.");
            return null;
        }
        ProviderManager providerManager = new ProviderManager(authenticationProviders, parentAuthenticationManager);
        if(eraseCredentials != null) {
            providerManager.setEraseCredentialsAfterAuthentication(eraseCredentials);
        }
        if(eventPublisher != null) {
            providerManager.setAuthenticationEventPublisher(eventPublisher);
        }
        providerManager = postProcess(providerManager);
        return providerManager;
    }
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

                "<authentication-manager>" +
                "  <authentication-provider>" +
                "    <jdbc-user-service cache-ref='userCache' data-source-ref='dataSource'/>" +
                "  </authentication-provider>" +
                "</authentication-manager>" + DATA_SOURCE + USER_CACHE_XML);
        ProviderManager mgr = (ProviderManager) appContext.getBean(BeanIds.AUTHENTICATION_MANAGER);
        DaoAuthenticationProvider provider = (DaoAuthenticationProvider) mgr.getProviders().get(0);
        assertSame(provider.getUserCache(), appContext.getBean("userCache"));
        provider.authenticate(new UsernamePasswordAuthenticationToken("rod","koala"));
        assertNotNull("Cache should contain user after authentication", provider.getUserCache().getUserFromCache("rod"));
    }
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

        ApplicationContext ctx =
                WebApplicationContextUtils.getRequiredWebApplicationContext(context);

        PasswordEncoder passwordEncoder = null;
        try {
            ProviderManager provider = (ProviderManager) ctx.getBean("org.springframework.security.authentication.ProviderManager#0");
            for (Object o : provider.getProviders()) {
                AuthenticationProvider p = (AuthenticationProvider) o;
                if (p instanceof RememberMeAuthenticationProvider) {
                    config.put("rememberMeEnabled", Boolean.TRUE);
                } else if (ctx.getBean("passwordEncoder") != null) {
                    passwordEncoder = (PasswordEncoder) ctx.getBean("passwordEncoder");
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

//                if (logger.isDebugEnabled()) {
//                    logger.debug("Previously Authenticated: " + authentication);
//                }
//                return authentication;
            }else{
              ProviderManager authenticationManager = (ProviderManager)StorageService.ctx.getBean("customAuthenticationManager");
              authentication = authenticationManager.authenticate(authentication);

                // We don't authenticated.setAuthentication(true), because each provider should do that
//                if (logger.isDebugEnabled()) {
//                    logger.debug("Successfully Authenticated: " + authentication);
//                }
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

            log.debug(bean);
        }*/

        PasswordEncoder passwordEncoder = null;
        try {
            ProviderManager provider = (ProviderManager) ctx.getBean("org.springframework.security.authentication.ProviderManager#0");
            for (Object o : provider.getProviders()) {
                AuthenticationProvider p = (AuthenticationProvider) o;
                if (p instanceof RememberMeAuthenticationProvider) {
                    config.put("rememberMeEnabled", Boolean.TRUE);
                } else if (ctx.getBean("passwordEncoder") != null) {
                    passwordEncoder = (PasswordEncoder) ctx.getBean("passwordEncoder");
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

  @Override
  public Object postProcessAfterInitialization(Object bean, String beanName)
      throws BeansException {
    if(beanName.equals("authenticationManager")) {
      ProviderManager authManager = (ProviderManager) bean;
      if (addIndex < 0) {
        authManager.getProviders().add(providerToAdd);
      } else {
        authManager.getProviders().add(addIndex, providerToAdd );
      }
    }
    return bean;
  }
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

            log.debug(bean);
        }*/

        PasswordEncoder passwordEncoder = null;
        try {
            ProviderManager provider = (ProviderManager) ctx.getBean("org.springframework.security.authenticationManager");
            for (Object o : provider.getProviders()) {
                AuthenticationProvider p = (AuthenticationProvider) o;
                if (p instanceof RememberMeAuthenticationProvider) {
                    config.put("rememberMeEnabled", Boolean.FALSE);
                } else if (ctx.getBean("passwordEncoder") != null) {
                    passwordEncoder = (PasswordEncoder) ctx.getBean("passwordEncoder");
View Full Code Here

Examples of org.springframework.security.authentication.ProviderManager

    // Make injection of spring beans in wicket-related classes possible using
    // @SpringBean.
    addComponentInstantiationListener(new SpringComponentInjector(this, appctx, true));

    ProviderManager authMan = new ProviderManager();
    List<TestingAuthenticationProvider> providerList =
      new ArrayList<TestingAuthenticationProvider>();
    providerList.add(new TestingAuthenticationProvider());
    authMan.setProviders(providerList);

    // appctx.putBean("testAuthenticationProvider", authProvider);
    // appctx.putBean("authenticationManager", authMan);
    this.authenticationManager = authMan;
View Full Code Here

Examples of org.springframework.security.providers.ProviderManager

      DaoAuthenticationProvider dap;
      @Inject
      AnonymousAuthenticationProvider aap;

      public AuthenticationManager get() {
        final ProviderManager pm = new ProviderManager();
        pm.setProviders(Arrays.asList(new Object[] {
          dap, aap }));
        return pm;
      }

    }).in(Scopes.SINGLETON);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.