@Autowired public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("bill").password("root123").roles("USER"); auth.inMemoryAuthentication().withUser("admin").password("root123").roles("ADMIN"); auth.inMemoryAuthentication() .withUser("dba") .password("root123") .roles("ADMIN", "DBA"); // dba have two roles. }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("admin") .password("admin") .authorities(AuthorityUtils.createAuthorityList(Role.ROLE_ADMIN.toString())) .and() .withUser("user") .password("user") .authorities(AuthorityUtils.createAuthorityList(Role.ROLE_USER.toString())); auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder()); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // @formatter:off auth.inMemoryAuthentication() .withUser("user") .password(this.userPassword) .roles("USER") .and() .withUser("admin") .password(this.userPassword) .roles("USER", "ADMIN"); auth.authenticationProvider(authenticationProviderBean()); // @formatter:on }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider(); authenticationProvider.setUserDetailsService(userDetailsService()); authenticationProvider.setPasswordEncoder(NoOpPasswordEncoder.getInstance()); auth.authenticationProvider(authenticationProvider); }
@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=? "); }
@Autowired public void config(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(localDatabaseAuthenticationProvider); // // auth.inMemoryAuthentication().withUser("mohamed_waleed").password("123").roles("ADMIN","USER").and() // .withUser("user2").password("1111").roles("ADMIN"); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication() .dataSource(dataSource) .usersByUsernameQuery(getUserQuery()) .authoritiesByUsernameQuery(getAuthoritiesQuery()); }
@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=?"); }
@Autowired protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService); // .inMemoryAuthentication() // .withUser("user") // .password("password") // .roles("USER","ADMIN"); }
@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 = ? "); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.ldapAuthentication() .userDnPatterns("uid={0},ou=people") .groupSearchBase("ou=groups") .contextSource() .ldif("classpath:test-server.ldif"); }
@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); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // for "refresh_token" to work a real UserDetailsService is necessary // auth.inMemoryAuthentication() // .withUser("donald").password("d8ck").roles("USER"); auth.userDetailsService(userDetailsService); }
@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 =?"); }
@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()); }
@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { BCryptPasswordEncoder passwordEncoder = passwordEncoder(); auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder); /*auth.jdbcAuthentication().dataSource(dataSource) .usersByUsernameQuery("select name, '1', 1 from users where name = ?") .authoritiesByUsernameQuery( "select users.name, authorities.name from users join user_authorities on users.id = user_authorities.user_id join authorities on user_authorities.authority_id = authorities.id where users.name = ?"); */ }
@SuppressWarnings("unused") private void configureTestLdap(AuthenticationManagerBuilder auth) throws Exception { // @formatter:off auth.ldapAuthentication() .userDnPatterns("uid={0},ou=people") .groupSearchBase("ou=groups") .contextSource() .ldif("classpath:test-server.ldif"); // @formatter:on }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("admin") .password("secret") .authorities("ROLE_ADMIN", "ROLE_USER") .and() .withUser("user1") .password("1111") .authorities("ROLE_USER"); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("marissa") .password("wombat") .roles("USER") .and() .withUser("sam") .password("kangaroo") .roles("USER"); }
@Override public void init(final AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("root") .password("root") .roles("ROOT", "USER") .and() .withUser("tux") .password("tux") .roles("USER"); }
@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("user") .password("password") .roles("USER") .and() .withUser("admin") .password("admin") .roles("ADMIN"); }
/* * User-details services */ @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth // <T extends UserDetailsService> // DaoAuthenticationConfigurer<AuthenticationManagerBuilder,T> // userDetailsService(T userDetailsService) .userDetailsService(userDetailsService) .passwordEncoder(passwordEncoder); // System.out.println(passwordEncoder.encode("asdasdasd")); }
@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");*/ }
@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("user1") .password("123456") .roles("USER") .and() .withUser("user2") .password("qwerty") .roles("USER", "ADMIN"); }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // Alternative is to set own customized userDetailsService auth.inMemoryAuthentication() .withUser(defaultUsername) .password(defaultPassword) .roles("USER") .and() .withUser("admin") .password("admin") .roles("ADMIN", "USER"); }
@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"); }
private void configureActiveDirectory(AuthenticationManagerBuilder auth) throws Exception { String domain = customProperties.getAdDomain(); String url = customProperties.getAdUrl(); if (domain != null) { ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider(domain, url); provider.setUserDetailsContextMapper(userDetailsContextMapper()); // Hm, this doesn't seem to have any effect, so handle the mapping in the // SeisoUserDetailsContextMapper. // provider.setAuthoritiesMapper(grantedAuthoritiesMapper()); auth.authenticationProvider(provider); } }
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("chuck") .password("password") .roles(USER_ROLE, SUPER_USER_ROLE) .and() .withUser("fred") .password("password") .roles(USER_ROLE) .and() .withUser("boss") .password("password") .roles(ADMIN); }