mirror of
https://gitee.com/dromara/sa-token.git
synced 2026-02-27 16:50:24 +08:00
优化 solon 的适配
This commit is contained in:
@@ -24,7 +24,6 @@ import org.noear.solon.annotation.Condition;
|
||||
import org.noear.solon.annotation.Configuration;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.AppContext;
|
||||
import org.noear.solon.core.bean.InitializingBean;
|
||||
|
||||
/**
|
||||
* @author noear
|
||||
@@ -33,12 +32,9 @@ import org.noear.solon.core.bean.InitializingBean;
|
||||
|
||||
@Condition(onClass = SaOAuth2Manager.class)
|
||||
@Configuration
|
||||
public class SaOAuth2AutoConfigure implements InitializingBean {
|
||||
@Inject
|
||||
private AppContext appContext;
|
||||
|
||||
@Override
|
||||
public void afterInjection() throws Throwable {
|
||||
public class SaOAuth2AutoConfigure {
|
||||
@Bean
|
||||
public void init(AppContext appContext) throws Throwable {
|
||||
appContext.subBeansOfType(SaOAuth2Template.class, bean -> {
|
||||
SaOAuth2Util.saOAuth2Template = bean;
|
||||
});
|
||||
|
||||
@@ -36,39 +36,37 @@ import org.noear.solon.core.bean.InitializingBean;
|
||||
|
||||
@Condition(onClass = SaSsoManager.class)
|
||||
@Configuration
|
||||
public class SaSsoAutoConfigure implements InitializingBean {
|
||||
@Inject
|
||||
private AppContext appContext;
|
||||
|
||||
@Override
|
||||
public void afterInjection() throws Throwable {
|
||||
appContext.subBeansOfType(SaSsoServerTemplate.class, bean->{
|
||||
public class SaSsoAutoConfigure {
|
||||
@Bean
|
||||
public void init(AppContext appContext) throws Throwable {
|
||||
appContext.subBeansOfType(SaSsoServerTemplate.class, bean -> {
|
||||
SaSsoServerProcessor.instance.ssoServerTemplate = bean;
|
||||
});
|
||||
appContext.subBeansOfType(SaSsoClientTemplate.class, bean->{
|
||||
appContext.subBeansOfType(SaSsoClientTemplate.class, bean -> {
|
||||
SaSsoClientProcessor.instance.ssoClientTemplate = bean;
|
||||
});
|
||||
|
||||
appContext.subBeansOfType(SaSsoServerConfig.class, bean->{
|
||||
appContext.subBeansOfType(SaSsoServerConfig.class, bean -> {
|
||||
SaSsoManager.setServerConfig(bean);
|
||||
});
|
||||
appContext.subBeansOfType(SaSsoClientConfig.class, bean->{
|
||||
appContext.subBeansOfType(SaSsoClientConfig.class, bean -> {
|
||||
SaSsoManager.setClientConfig(bean);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 SSO Server 配置Bean
|
||||
* */
|
||||
*/
|
||||
@Bean
|
||||
public SaSsoServerConfig getConfig(@Inject(value = "${sa-token.sso-server}",required = false) SaSsoServerConfig ssoConfig) {
|
||||
public SaSsoServerConfig getConfig(@Inject(value = "${sa-token.sso-server}", required = false) SaSsoServerConfig ssoConfig) {
|
||||
return ssoConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 SSO Client 配置Bean
|
||||
* */
|
||||
*/
|
||||
@Bean
|
||||
public SaSsoClientConfig getClientConfig(@Inject(value = "${sa-token.sso-client}",required = false) SaSsoClientConfig ssoConfig) {
|
||||
public SaSsoClientConfig getClientConfig(@Inject(value = "${sa-token.sso-client}", required = false) SaSsoClientConfig ssoConfig) {
|
||||
return ssoConfig;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user