当前位置: 首页>>代码示例>>Java>>正文


Java RememberMeAuthenticationProvider类代码示例

本文整理汇总了Java中org.springframework.security.authentication.RememberMeAuthenticationProvider的典型用法代码示例。如果您正苦于以下问题:Java RememberMeAuthenticationProvider类的具体用法?Java RememberMeAuthenticationProvider怎么用?Java RememberMeAuthenticationProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RememberMeAuthenticationProvider类属于org.springframework.security.authentication包,在下文中一共展示了RememberMeAuthenticationProvider类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
/**
 * Configures the authentication providers.
 *
 * @param auth a builder
 * @throws Exception ex
 */
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
	OpenIDAuthenticationProvider openidProvider = new OpenIDAuthenticationProvider();
	openidProvider.setAuthenticationUserDetailsService(new SimpleUserService());
	auth.authenticationProvider(openidProvider);

	RememberMeAuthenticationProvider rmeProvider = new RememberMeAuthenticationProvider(Config.APP_SECRET_KEY);
	auth.authenticationProvider(rmeProvider);

	JWTAuthenticationProvider jwtProvider = new JWTAuthenticationProvider();
	auth.authenticationProvider(jwtProvider);

	LDAPAuthenticationProvider ldapProvider = new LDAPAuthenticationProvider();
	auth.authenticationProvider(ldapProvider);
}
 
开发者ID:Erudika,项目名称:para,代码行数:22,代码来源:SecurityConfig.java

示例2: authenticationManager

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
@Bean
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public AuthenticationManager authenticationManager(){
      
      if (authenticationManager == null){
List providers = new ArrayList();
      providers.add(daoAuthenticationProvider());
      providers.add(new AnonymousAuthenticationProvider("changeThis"));
      providers.add(new RememberMeAuthenticationProvider("changeThis"));
      
      ProviderManager bean = new ProviderManager(providers);
      authenticationManager = bean;
      }
      return authenticationManager;
  }
 
开发者ID:dovier,项目名称:coj-web,代码行数:16,代码来源:SecurityConfiguration.java

示例3: rememberMeAuthenticationProvider

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
@Bean
RememberMeAuthenticationProvider rememberMeAuthenticationProvider(){
    return new RememberMeAuthenticationProvider("SpringRocks");
}
 
开发者ID:AgainstWind,项目名称:spring-cloud-demos,代码行数:5,代码来源:SecurityConfig.java

示例4: rememberMeAuthenticationProvider

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
/**
 * <p>rememberMeAuthenticationProvider.</p>
 *
 * @return a {@link org.springframework.security.authentication.RememberMeAuthenticationProvider} object.
 */
@Bean
public RememberMeAuthenticationProvider rememberMeAuthenticationProvider() {
    return new RememberMeAuthenticationProvider(
            environment.getProperty("spring.application.name", "securedApp"));
}
 
开发者ID:rajadilipkolli,项目名称:springsecuredthymeleafapp,代码行数:11,代码来源:SecurityConfiguration.java

示例5: rememberMeAuthenticationProvider

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
@Bean
public RememberMeAuthenticationProvider rememberMeAuthenticationProvider() {
    return new RememberMeAuthenticationProvider(env.getProperty("security.rememberme.key"));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:SecurityConfiguration.java

示例6: contextInitialized

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
@SuppressWarnings( { "unchecked" })
   public void contextInitialized(ServletContextEvent event) {
log.debug("initializing context...");

ServletContext context = event.getServletContext();

// Orion starts Servlets before Listeners, so check if the config
// object already exists
Map<String, Object> config = (HashMap<String, Object>) context
	.getAttribute(Constants.CONFIG);

if (config == null) {
    config = new HashMap<String, Object>();
}

if (context.getInitParameter(Constants.CSS_THEME) != null) {
    config.put(Constants.CSS_THEME, context
	    .getInitParameter(Constants.CSS_THEME));
}

ApplicationContext ctx = WebApplicationContextUtils
	.getRequiredWebApplicationContext(context);

boolean encryptPassword = true;

   try {
       ProviderManager provider = (ProviderManager) ctx.getBean(ctx.getBeanNamesForType(ProviderManager.class)[0]);
       for (Object o : provider.getProviders()) {
           AuthenticationProvider p = (AuthenticationProvider) o;
           if (p instanceof RememberMeAuthenticationProvider) {
               config.put("rememberMeEnabled", Boolean.TRUE);
           } 
           config.put(Constants.ENCRYPT_PASSWORD, Boolean.TRUE);
           config.put(Constants.ENC_ALGORITHM, "SHA");
       }
   } catch (NoSuchBeanDefinitionException n) {
       log.debug("authenticationManager bean not found, assuming test and ignoring...");
       // ignore, should only happen when testing
   }


context.setAttribute(Constants.CONFIG, config);

// output the retrieved values for the Init and Context Parameters
if (log.isDebugEnabled()) {
    log
	    .debug("Remember Me Enabled? "
		    + config.get("rememberMeEnabled"));
    log.debug("Encrypt Passwords? " + encryptPassword);
    if (encryptPassword) {
	log.debug("Encryption Algorithm: "
		+ config.get(Constants.ENC_ALGORITHM));
    }
    log.debug("Populating drop-downs...");
}

setupContext(context);
   }
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:59,代码来源:StartupListener.java

示例7: contextInitialized

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
public void contextInitialized(ServletContextEvent event) {
    log.debug("Initializing context...");

    ServletContext context = event.getServletContext();

    // Orion starts Servlets before Listeners, so check if the config
    // object already exists
    Map<String, Object> config = (HashMap<String, Object>) context.getAttribute(Constants.CONFIG);

    if (config == null) {
        config = new HashMap<String, Object>();
    }

    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");
            }
        }
    } catch (NoSuchBeanDefinitionException n) {
        log.debug("authenticationManager bean not found, assuming test and ignoring...");
        // ignore, should only happen when testing
    }

    context.setAttribute(Constants.CONFIG, config);

    // output the retrieved values for the Init and Context Parameters
    if (log.isDebugEnabled()) {
        log.debug("Remember Me Enabled? " + config.get("rememberMeEnabled"));
        if (passwordEncoder != null) {
            log.debug("Password Encoder: " + passwordEncoder.getClass().getSimpleName());
        }
        log.debug("Populating drop-downs...");
    }

    setupContext(context);
    
    // Determine version number for CSS and JS Assets
    String appVersion = null;
    try {
        InputStream is = context.getResourceAsStream("/META-INF/MANIFEST.MF");
        if (is == null) {
            log.warn("META-INF/MANIFEST.MF not found.");
        } else {
            Manifest mf = new Manifest();
            mf.read(is);
            Attributes atts = mf.getMainAttributes();
            appVersion = atts.getValue("Implementation-Version");
        }
    } catch (IOException e) {
        log.error("I/O Exception reading manifest: " + e.getMessage());
    }

    // If there was a build number defined in the war, then use it for
    // the cache buster. Otherwise, assume we are in development mode
    // and use a random cache buster so developers don't have to clear
    // their browser cache.
    if (appVersion == null || appVersion.contains("SNAPSHOT")) {
        appVersion = "" + new Random().nextInt(100000);
    }

    log.info("Application version set to: " + appVersion);
    context.setAttribute(Constants.ASSETS_VERSION, appVersion);
}
 
开发者ID:SMVBE,项目名称:ldadmin,代码行数:77,代码来源:StartupListener.java

示例8: rememberMeAuthenticationProvider

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
@Bean
public RememberMeAuthenticationProvider rememberMeAuthenticationProvider() {
    return new RememberMeAuthenticationProvider(environment.getProperty("RM_KEY", "grassrootremembers"));
}
 
开发者ID:grassrootza,项目名称:grassroot-platform,代码行数:5,代码来源:SecurityConfig.java

示例9: rememberMeAuthenticationProvider

import org.springframework.security.authentication.RememberMeAuthenticationProvider; //导入依赖的package包/类
@Bean
public RememberMeAuthenticationProvider rememberMeAuthenticationProvider() {
    return new RememberMeAuthenticationProvider(env.getProperty("jhipster.security.rememberme.key"));
}
 
开发者ID:ravikiran438,项目名称:cevent-app,代码行数:5,代码来源:SecurityConfiguration.java


注:本文中的org.springframework.security.authentication.RememberMeAuthenticationProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。