@Override
 protected void configure(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(dataSource)
       .usersByUsernameQuery(getUserQuery())
       .authoritiesByUsernameQuery(getAuthoritiesQuery());
 }
예제 #2
0
  @Override
  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    // BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(10, new SecureRandom());

    auth.jdbcAuthentication().dataSource(dataSource);
    //   .passwordEncoder(passwordEncoder);
  }
 @Autowired
 public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(dataSource)
       .withUser("user")
       .password("password")
       .roles("ANONYMOUS")
       .and()
       .withUser("admin")
       .password("admin")
       .roles("ADMIN")
       .and()
       .withUser("Ann")
       .password("Boe")
       .roles("USER")
       .and()
       .withUser("Bob")
       .password("Joe")
       .roles("USER")
       .and()
       .withUser("Jon")
       .password("Doe")
       .roles("USER")
       .and()
       .withUser("Rob")
       .password("Zoe")
       .roles("USER");
   ;
 }
 @Override
 protected void configure(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(dataSource)
       .usersByUsernameQuery("SELECT username,password,enable FROM tbuser WHERE username=?")
       .authoritiesByUsernameQuery("SELECT username,role FROM tbuser WHERE username=? ");
 }
예제 #5
0
 @Autowired
 public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(datasource)
       .usersByUsernameQuery("select username, password, enabled from users where username=?")
       .authoritiesByUsernameQuery(
           "select u.username, r.role from users as u, user_roles as r where u.id = r.user_id and u.username=?");
 }
 @Override
 protected void configure(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(dataSource)
       .usersByUsernameQuery("select username, password, enabled from users where username = ?")
       .authoritiesByUsernameQuery(
           "select username, permission.name as role from permission, users, user_perm where users.id = user_perm.user_id and permission.id = user_perm.perm_id and users.username = ? ");
 }
  @Autowired
  public void configAuthentication(AuthenticationManagerBuilder auth) throws Exception {

    auth.jdbcAuthentication()
        .dataSource(dataSource)
        .passwordEncoder(passwordEncoder())
        .usersByUsernameQuery("select username,password, enabled from users where username=?")
        .authoritiesByUsernameQuery("select username, role from user_roles where username =?");
  }
예제 #8
0
 @Override
 public void configure(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(dataSource)
       .usersByUsernameQuery(
           "select username, password, enabled from ba_user where username = ?")
       .authoritiesByUsernameQuery("select username, role from authority where username = ?")
       .passwordEncoder(passwordEncoder);
 }
예제 #9
0
 @Autowired
 public void globalSecurityConfiguration(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(dataSource())
       .usersByUsernameQuery(
           "select u.nomeDeUsuario, u.senha, true from usuario as u where ? in (u.nomeDeUsuario, u.email)")
       .authoritiesByUsernameQuery(
           "select nomeDeUsuario, papel from usuario where nomeDeUsuario = ?")
       .passwordEncoder(new BCryptPasswordEncoder());
 }
 @Override
 protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication().dataSource(configureDataSource);
   /*
   auth
       .inMemoryAuthentication()
           .withUser("Blake").password("password").roles("USER").and()
           .withUser("Adam").password("password").roles("USER").and()
           .withUser("Anders").password("password").roles("USER").and()
           .withUser("admin").password("admin").roles("USER", "ADMIN");*/
 }
  @Override
  public void configure(AuthenticationManagerBuilder auth) throws Exception {

    // the default authentication is an in memory user called "user" with a generated password at
    // start up
    // i.e. Using default security password: 63ee012d-4ea5-4476-b925-edef1b8c52fe
    auth.jdbcAuthentication()
        .dataSource(this.dataSource)
        .withDefaultSchema()
        .withUser("admin")
        .password("admin")
        .roles("ADMIN");
  }
 @Autowired
 public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
   // @formatter:off
   auth.jdbcAuthentication().dataSource(dataSource).passwordEncoder(passwordEncoder());
   // @formatter:on
 }
 @Override
 protected void configure(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication().dataSource(dataSource).userCache(userCache());
 }
 @Autowired
 public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication()
       .dataSource(this.dataSource)
       .passwordEncoder(new BCryptPasswordEncoder());
 }
예제 #15
0
 @Autowired
 public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception {
   auth.jdbcAuthentication().passwordEncoder(passwordEncoder()).dataSource(dataSource);
 }