Here are the examples of the java api org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
155 Examples
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY).authoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchFilter("(uid={0})").groupSearchBase("ou=Groups").contextSource(contextSource());
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("USER", "ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchBase("").userSearchFilter("(uid={0})").groupSearchBase("ou=Groups").groupSearchFilter("(uniqueMember={0})").userDetailsContextMapper(new InetOrgPersonContextMapper()).contextSource(contextSource()).preplacedwordCompare().preplacedwordAttribute("telephoneNumber");
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY).authoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {userDetailsService()}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("USER", "ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("USER", "ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("[email protected]").preplacedword("user1").roles("USER");
logger.info("***** Preplacedword for user '[email protected]' is 'user1'");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY).authoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY).authoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
// @Autowired
// @SuppressWarnings("SpringJavaAutowiringInspection")
// private DataSource dataSource;
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(calendarUserDetailsService).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchFilter("(uid={0})").groupSearchBase("ou=Groups").userDetailsContextMapper(new InetOrgPersonContextMapper()).contextSource(contextSource());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchBase("").userSearchFilter("(uid={0})").groupSearchBase("ou=Groups").groupSearchFilter("(uniqueMember={0})").contextSource(contextSource()).preplacedwordCompare().preplacedwordEncoder(new LdapShaPreplacedwordEncoder()).preplacedwordAttribute("userPreplacedword");
/*
<ldap-authentication-provider server-ref="ldapServer"
user-search-filter="(uid={0})"
group-search-base="ou=Groups"
user-details-clreplaced="inetOrgPerson">
<bean id="ldapAuthenticationProvider"
clreplaced="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
<constructor-arg ref="ldapBindAuthenticator"/>
<constructor-arg ref="ldapAuthoritiesPopulator"/>
<property name="userDetailsContextMapper" ref="ldapUserDetailsContextMapper"/>
</bean>
<bean id="ldapBindAuthenticator"
clreplaced="org.springframework.security.ldap.authentication.BindAuthenticator">
<constructor-arg ref="ldapServer"/>
<property name="userSearch" ref="ldapSearch"/>
</bean>
// <bean id="ldapSearch"
// clreplaced="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
// <constructor-arg value=""/> <!-- use-search-base -->
// <constructor-arg value="(uid={0})"/> <!-- user-search-filter -->
// <constructor-arg ref="ldapServer"/>
// </bean>
// <bean id="ldapAuthoritiesPopulator"
// clreplaced="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
// <constructor-arg ref="ldapServer"/>
// <constructor-arg value="ou=Groups"/>
// <property name="groupSearchFilter" value="(uniqueMember={0})"/>
// </bean>
*/
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY).authoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
// @Autowired
// @SuppressWarnings("SpringJavaAutowiringInspection")
// private DataSource dataSource;
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(calendarUserDetailsService).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchBase("").userSearchFilter("(uid={0})").groupSearchBase("ou=Groups").groupSearchFilter("(uniqueMember={0})").userDetailsContextMapper(new InetOrgPersonContextMapper()).contextSource(contextSource()).preplacedwordCompare().preplacedwordEncoder(new LdapShaPreplacedwordEncoder()).preplacedwordAttribute("userPreplacedword");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource);
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY).authoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY).preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).usersByUsernameQuery(CUSTOM_USERS_BY_USERNAME_QUERY).authoritiesByUsernameQuery(CUSTOM_AUTHORITIES_BY_USERNAME_QUERY);
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("[email protected]").preplacedword("user1").roles("USER");
logger.info("***** Preplacedword for user '[email protected]' is 'user1'");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("USER", "ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfiguration.java
Copyright Apache License 2.0
Author : soumyadip007
Copyright Apache License 2.0
Author : soumyadip007
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// use jdbc authentication ... oh yeah!!!
auth.jdbcAuthentication().dataSource(securityDataSource).usersByUsernameQuery("select username,preplacedword,enabled from user where username=?").authoritiesByUsernameQuery("select username, authority from user where username=?").preplacedwordEncoder(preplacedwordEncoder());
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {userDetailsService()}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(cuap);
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {userDetailsService()}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("USER", "ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").preplacedword("user").roles("USER").and().withUser("admin").preplacedword("admin").roles("ADMIN").and().withUser("[email protected]").preplacedword("user1").roles("USER").and().withUser("[email protected]").preplacedword("admin1").roles("USER", "ADMIN");
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {@link super.userDetailsService()}
* @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchBase("").userSearchFilter("(uid={0})").groupSearchBase("ou=Groups").groupSearchFilter("(uniqueMember={0})").userDetailsContextMapper(new InetOrgPersonContextMapper()).contextSource(contextSource()).preplacedwordCompare().preplacedwordEncoder(new LdapShaPreplacedwordEncoder()).preplacedwordAttribute("userPreplacedword");
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
/**
* Configure AuthenticationManager with inMemory credentials.
*
* NOTE:
* Due to a known limitation with JavaConfig:
* <a href="https://jira.spring.io/browse/SPR-13779">
* https://jira.spring.io/browse/SPR-13779</a>
*
* We cannot use the following to expose a {@link UserDetailsManager}
* <pre>
* http.authorizeRequests()
* </pre>
*
* In order to expose {@link UserDetailsManager} as a bean, we must create @Bean
*
* @see {super.userDetailsService()}
* @see {@link DefaultCalendarService}
*
* @param auth AuthenticationManagerBuilder
* @throws Exception Authentication exception
*/
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource).groupAuthoritiesByUsername(CUSTOM_GROUP_AUTHORITIES_BY_USERNAME_QUERY);
}
19
View Complete Implementation : SecurityConfig.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchBase("").userSearchFilter("(uid={0})").groupSearchBase("ou=Groups").groupSearchFilter("(uniqueMember={0})").userDetailsContextMapper(new InetOrgPersonContextMapper()).contextSource(contextSource()).preplacedwordCompare().preplacedwordAttribute("telephoneNumber");
}