List of usage examples for org.springframework.security.config.annotation.authentication.builders AuthenticationManagerBuilder inMemoryAuthentication
public InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuthentication() throws Exception
From source file:com.netflix.genie.web.security.SecurityConfig.java
/** * Configure the global authentication manager. * * @param auth The builder to configure//from w w w .j a v a 2 s . c o m * @throws Exception on error */ @Autowired protected void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception { if (this.providers != null) { for (final AuthenticationProvider provider : this.providers) { log.debug("Adding authentication provider {} to authentication provider.", provider); auth.authenticationProvider(provider); } } else { // in the case nothing was configured log.debug("No providers were found. Configuring in memory authentication to avoid NPE."); auth.inMemoryAuthentication(); } }
From source file:org.kuali.coeus.sys.framework.security.SpringRestSecurity.java
@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { String userName = configurationService.getPropertyValueAsString(KC_REST_ADMIN_USERNAME); String password = configurationService.getPropertyValueAsString(KC_REST_ADMIN_PASSWORD); if (StringUtils.isNotBlank(userName) && StringUtils.isNotBlank(password)) { auth.inMemoryAuthentication().withUser(userName).password(password).roles(ADMIN_ROLE); }/*from w w w. j a v a 2 s . c o m*/ }
From source file:org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.java
/** * Convenience method for building the default AuthenticationManager from * SecurityProperties./*from w ww.ja v a2 s . c om*/ * * @param builder the AuthenticationManagerBuilder to use * @param security the SecurityProperties in use */ public static void authentication(AuthenticationManagerBuilder builder, SecurityProperties security) throws Exception { if (isBuilt(builder)) { return; } User user = security.getUser(); if (user.isDefaultPassword()) { logger.info("\n\nUsing default password for application endpoints: " + user.getPassword() + "\n\n"); } Set<String> roles = new LinkedHashSet<String>(user.getRole()); builder.inMemoryAuthentication().withUser(user.getName()).password(user.getPassword()) .roles(roles.toArray(new String[roles.size()])); }