All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.daijie.shiro.oauth2.configure.ShiroAuthenticationConfigure Maven / Gradle / Ivy

The newest version!
package org.daijie.shiro.oauth2.configure;

import org.daijie.core.feign.RestTemplateConfigure;
import org.daijie.shiro.oauth2.AuthenticationMatch;
import org.daijie.shiro.oauth2.RequestAuthenticationMatch;
import org.daijie.shiro.oauth2.ShiroAuthenticationManager;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * shiro oauth2权限初始化bean
 * @author daijie_jay
 * @since 2017年12月27日
 */
@EnableConfigurationProperties(ShiroOauth2Properties.class)
@Import(RestTemplateConfigure.class)
@Configuration
public class ShiroAuthenticationConfigure {

	@Bean
	public AuthenticationManager authenticationManager(AuthenticationMatch authenticationMatch){
		ShiroAuthenticationManager authenticationManager = new ShiroAuthenticationManager();
		authenticationManager.setAuthenticationMatch(authenticationMatch);
		return authenticationManager;
	}

	@Bean
	public AuthenticationMatch authenticationMatch(){
		return new RequestAuthenticationMatch();
	}
	
  @Bean
  PasswordEncoder passwordEncoder(){
      return new BCryptPasswordEncoder();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy