Example usage for org.springframework.security.config.annotation.authentication.builders AuthenticationManagerBuilder inMemoryAuthentication

List of usage examples for org.springframework.security.config.annotation.authentication.builders AuthenticationManagerBuilder inMemoryAuthentication

Introduction

In this page you can find the example usage for org.springframework.security.config.annotation.authentication.builders AuthenticationManagerBuilder inMemoryAuthentication.

Prototype

public InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuthentication()
        throws Exception 

Source Link

Document

Add in memory authentication to the AuthenticationManagerBuilder and return a InMemoryUserDetailsManagerConfigurer to allow customization of the in memory authentication.

Usage

From source file:fi.codecenter.courses.SpringSecurityConfig.java

/**
 * An additional example adding bcrypt password hashing to the in-memory
 * user database. The password value is a hash of 'password'. As the seed is
 * a random value part of the hash, encoding the password again would give a
 * different result./* w ww .  jav  a  2 s.c  om*/
 *
 * @param auth
 * @throws Exception
 */
private void exampleWithPasswordEncoding(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().passwordEncoder(new BCryptPasswordEncoder()).withUser("user")
            .password("$2a$10$lCXaUM1pDyFu4xsp5LJz/uXrNz3zJDu.cyiAV./g3fCS1sg3UfVFS").roles("USER");
}

From source file:br.com.fpu.eiiv.qrcode.WebSecurityConfiguration.java

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    // @formatter:off
    auth.inMemoryAuthentication().withUser("fpu").password("123").roles("USER");
    // @formatter:on
}

From source file:com.ucrisko.libroomreserve.config.WebSecurityConfig.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().withUser("user").password("password").roles("USER").and().withUser("cpuzzuol")
            .password("epthnw2y").roles("ADMIN", "USER");

    /*//from ww  w. jav  a  2s.c  o  m
      auth
    .jdbcAuthentication()
        .dataSource(dataSource)
        .usersByUsernameQuery("SELECT userName FROM user WHERE userName=?")
        .authoritiesByUsernameQuery("SELECT userName FROM user WHERE userName=?");
      */
}

From source file:br.com.d4j.apostei.api.SecurityConfiguration.java

/**
 * {@inheritDoc}/*ww w  . ja v a2s.  c  o  m*/
 */
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {

    auth.inMemoryAuthentication().//
            withUser("greg").password("turnquist").roles("USER").and().//
            withUser("ollie").password("gierke").roles("USER", "ADMIN");
}

From source file:ch.thp.proto.spring.time.web.config.SecurityConfig.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().withUser("ned").password("123").roles("USER").and().withUser("heisenberg")
            .password("123").roles("USER").and().withUser("don").password("123").roles("ADMIN", "USER");
}

From source file:showcase.WebSecurityConfiguration.java

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    // @formatter:off
    auth.inMemoryAuthentication().withUser("roy").password("spring").roles("USER");
    // @formatter:on
}

From source file:julie.com.mikaelson.application.WebSecurityConfig.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().withUser("user").password("password").roles("ADMIN");
}

From source file:org.fede.calculator.web.SecurityConfig.java

@Override
protected void configure(AuthenticationManagerBuilder authManagerBuilder) throws Exception {
    authManagerBuilder.inMemoryAuthentication().passwordEncoder(new ShaPasswordEncoder(512))
            .withUser(this.username).password(this.password).roles(this.roles);
}

From source file:org.owasp.webgoat.WebSecurityConfig.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication().withUser("guest").password("guest").roles("WEBGOAT_USER").and() //
            .withUser("webgoat").password("webgoat").roles("WEBGOAT_ADMIN").and() //
            .withUser("server").password("server").roles("SERVER_ADMIN");
}

From source file:ch.rasc.s4ws.portfolio.config.WebSecurityConfig.java

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    // @formatter:off
    auth.inMemoryAuthentication().withUser("fabrice").password("fab123").roles("USER").and().withUser("paulson")
            .password("bond").roles("ADMIN", "USER");
    // @formatter:on
}