Package org.springframework.security.providers

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


        log.info("Remember Me enabled: " + rememberMeEnabled);
       
        context.setAttribute("rememberMeEnabled", rememberMe);
       
        if (!rememberMeEnabled) {
            ProviderManager provider = (ProviderManager) ctx.getBean("_authenticationManager");
            for (Iterator it = provider.getProviders().iterator(); it.hasNext();) {
                AuthenticationProvider authProvider = (AuthenticationProvider) it.next();
                if (authProvider instanceof RememberMeAuthenticationProvider) {
                    provider.getProviders().remove(authProvider);
                }
            }
        }
       
        String encryptPasswords = WebloggerConfig.getProperty("passwds.encryption.enabled");
        boolean doEncrypt = Boolean.valueOf(encryptPasswords).booleanValue();
       
        if (doEncrypt) {
            DaoAuthenticationProvider provider = (DaoAuthenticationProvider) ctx.getBean("org.springframework.security.providers.dao.DaoAuthenticationProvider#0");
            String algorithm = WebloggerConfig.getProperty("passwds.encryption.algorithm");
            PasswordEncoder encoder = null;
            if (algorithm.equalsIgnoreCase("SHA")) {
                encoder = new ShaPasswordEncoder();
            } else if (algorithm.equalsIgnoreCase("MD5")) {
                encoder = new Md5PasswordEncoder();
            } else {
                log.error("Encryption algorithm '" + algorithm + "' not supported, disabling encryption.");
            }
            if (encoder != null) {
                provider.setPasswordEncoder(encoder);
                log.info("Password Encryption Algorithm set to '" + algorithm + "'");
            }
        }

        if (WebloggerConfig.getBooleanProperty("securelogin.enabled")) {
View Full Code Here

    @Override
    protected void setUpInternal() throws Exception {
        super.setUpInternal();

        ProviderManager providerManager = (ProviderManager) GeoServerExtensions
                .bean("authenticationManager");
        List<AuthenticationProvider> list = new ArrayList<AuthenticationProvider>();
        list.add(new TestingAuthenticationProvider());
        providerManager.setProviders(list);

        Authentication admin = new TestingAuthenticationToken("admin", "geoserver",
                new GrantedAuthority[] { new XACMLRole("ROLE_ADMINISTRATOR") });
        // Authentication anonymous = new TestingAuthenticationToken("anonymous", null, null);
        SecurityContextHolder.getContext().setAuthentication(admin);
View Full Code Here

    @Override
    protected void setUpInternal() throws Exception {
        super.setUpInternal();

        ProviderManager providerManager = (ProviderManager) GeoServerExtensions
                .bean("authenticationManager");
        List<AuthenticationProvider> list = new ArrayList<AuthenticationProvider>();
        list.add(new TestingAuthenticationProvider());
        providerManager.setProviders(list);

        Authentication admin = new TestingAuthenticationToken("admin", "geoserver",
                new GrantedAuthority[] { new XACMLRole("ROLE_ADMINISTRATOR") });
        // Authentication anonymous = new TestingAuthenticationToken("anonymous", null, null);
        SecurityContextHolder.getContext().setAuthentication(admin);
View Full Code Here

TOP

Related Classes of org.springframework.security.providers.ProviderManager

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.