BaseAuthenticationConfig groovy->java

Issue: gh-4939
This commit is contained in:
Rob Winch 2018-02-06 15:47:47 -06:00
parent 4fbfb710f5
commit 2165cc72ef

View File

@ -13,19 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.security.config.annotation.authentication package org.springframework.security.config.annotation.authentication;
import java.rmi.registry.Registry;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Configuration
import org.springframework.security.authentication.AuthenticationManager
import org.springframework.security.config.annotation.authentication.AuthenticationManagerBuilder
import org.springframework.security.config.annotation.authentication.configurers.userdetails.UserDetailsServiceConfigurer;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.configurers.provisioning.InMemoryUserDetailsManagerConfigurer;
import org.springframework.security.core.userdetails.UserDetailsService;
/** /**
@ -33,12 +25,12 @@ import org.springframework.security.core.userdetails.UserDetailsService;
* @author Rob Winch * @author Rob Winch
*/ */
@Configuration @Configuration
class BaseAuthenticationConfig { public class BaseAuthenticationConfig {
@Autowired @Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception { protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth auth
.inMemoryAuthentication() .inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and() .withUser("user").password("password").roles("USER").and()
.withUser("admin").password("password").roles("USER", "ADMIN").and() .withUser("admin").password("password").roles("USER", "ADMIN");
} }
} }