@Bean public to default

This commit is contained in:
shimingxy
2024-08-19 16:24:47 +08:00
parent b7b0cd21c6
commit b6f9828ff7
24 changed files with 291 additions and 291 deletions

View File

@@ -60,76 +60,76 @@ import org.springframework.ui.velocity.VelocityEngineFactoryBean;
})
public class Saml20AutoConfiguration implements InitializingBean {
private static final Logger _logger = LoggerFactory.getLogger(Saml20AutoConfiguration.class);
/**
* samlBootstrapInitializer.
* @return samlBootstrapInitializer
* @throws ConfigurationException
*/
@Bean(name = "samlBootstrapInitializer")
public String samlBootstrapInitializer() throws ConfigurationException {
String samlBootstrapInitializer() throws ConfigurationException {
org.opensaml.DefaultBootstrap.bootstrap();
return "";
}
/**
* TimeService.
* @return timeService
*/
@Bean(name = "timeService")
public TimeService TimeService() {
TimeService TimeService() {
TimeService timeService = new TimeService();
return timeService;
}
/**
* IDService.
* @return idService
*/
@Bean(name = "idService")
public IDService idService() {
IDService idService() {
IDService idService = new IDService();
return idService;
}
/**
* EndpointGenerator.
* @return endpointGenerator
*/
@Bean(name = "endpointGenerator")
public EndpointGenerator endpointGenerator() {
EndpointGenerator endpointGenerator() {
EndpointGenerator generator = new EndpointGenerator();
return generator;
}
/**
* AuthnResponseGenerator.
* @return authnResponseGenerator
*/
@Bean(name = "authnResponseGenerator")
public AuthnResponseGenerator authnResponseGenerator(TimeService timeService,IDService idService,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
AuthnResponseGenerator authnResponseGenerator(TimeService timeService, IDService idService,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
_logger.debug("issuerEntityName {}" , issuerEntityName);
AuthnResponseGenerator generator = new AuthnResponseGenerator(issuerEntityName,timeService,idService);
return generator;
}
/**
* IssuerEntityName.
* @return issuerEntityName
*/
@Bean(name = "issuerEntityName")
public String issuerEntityName(
String issuerEntityName(
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
return issuerEntityName;
}
/**
* Saml20Metadata.
* @return saml20Metadata
*/
@Bean(name = "saml20Metadata")
public Saml20Metadata saml20Metadata(
Saml20Metadata saml20Metadata(
@Value("${maxkey.saml.v20.metadata.orgName}") String orgName,
@Value("${maxkey.saml.v20.metadata.orgDisplayName}") String orgDisplayName,
@Value("${maxkey.saml.v20.metadata.orgURL}") String orgURL,
@@ -157,31 +157,31 @@ public class Saml20AutoConfiguration implements InitializingBean {
* @return samlValidaotrSuite
*/
@Bean(name = "samlValidaotrSuite")
public SAML2ValidatorSuite validatorSuite() {
SAML2ValidatorSuite validatorSuite() {
SAML2ValidatorSuite validatorSuite = new SAML2ValidatorSuite();
return validatorSuite;
}
/**
* MapBasedStorageService.
* @return mapBasedStorageService
*/
@SuppressWarnings("rawtypes")
@Bean(name = "mapBasedStorageService")
public MapBasedStorageService mapBasedStorageService() {
MapBasedStorageService mapBasedStorageService() {
MapBasedStorageService mapBasedStorageService = new MapBasedStorageService();
return mapBasedStorageService;
}
/**
* VelocityEngineFactoryBean.
* @return velocityEngine
* @throws IOException
* @throws VelocityException
*/
@SuppressWarnings({ "deprecation"})
@SuppressWarnings({"deprecation"})
@Bean(name = "velocityEngine")
public VelocityEngine velocityEngine() throws VelocityException, IOException {
VelocityEngine velocityEngine() throws VelocityException, IOException {
VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
factory.setPreferFileSystemAccess(false);
Properties velocityProperties = new Properties();
@@ -191,138 +191,138 @@ public class Saml20AutoConfiguration implements InitializingBean {
factory.setVelocityProperties(velocityProperties);
return factory.createVelocityEngine();
}
/**
* ReplayCache.
* @return replayCache
*/
@Bean(name = "replayCache")
public ReplayCache replayCache(MapBasedStorageService<String, ReplayCacheEntry> mapBasedStorageService,
@Value("${maxkey.saml.v20.replay.cache.life.in.millis}") long duration) {
ReplayCache replayCache(MapBasedStorageService<String, ReplayCacheEntry> mapBasedStorageService,
@Value("${maxkey.saml.v20.replay.cache.life.in.millis}") long duration) {
ReplayCache replayCache = new ReplayCache(mapBasedStorageService,duration);
return replayCache;
}
/**
* MessageReplayRule.
* @return messageReplayRule
*/
@Bean(name = "messageReplayRule")
public MessageReplayRule messageReplayRule(ReplayCache replayCache) {
MessageReplayRule messageReplayRule(ReplayCache replayCache) {
MessageReplayRule messageReplayRule = new MessageReplayRule(replayCache);
return messageReplayRule;
}
/**
* BasicParserPool.
* @return samlParserPool
*/
@Bean(name = "samlParserPool")
public BasicParserPool samlParserPool(
BasicParserPool samlParserPool(
@Value("${maxkey.saml.v20.max.parser.pool.size}") int maxPoolSize) {
BasicParserPool samlParserPool = new BasicParserPool();
samlParserPool.setMaxPoolSize(maxPoolSize);
return samlParserPool;
}
/**
* IssueInstantRule.
* @return issueInstantRule
*/
@Bean(name = "issueInstantRule")
public IssueInstantRule issueInstantRule(
IssueInstantRule issueInstantRule(
@Value("${maxkey.saml.v20.issue.instant.check.clock.skew.in.seconds}") int newClockSkew,
@Value("${maxkey.saml.v20.issue.instant.check.validity.time.in.seconds}") int newExpires) {
IssueInstantRule decoder = new IssueInstantRule(newClockSkew,newExpires);
decoder.setRequiredRule(true);
return decoder;
}
/**
* OpenHTTPPostSimpleSignDecoder.
* @return openHTTPPostSimpleSignDecoder
*/
@Bean(name = "openHTTPPostSimpleSignDecoder")
public OpenHTTPPostSimpleSignDecoder openHTTPPostSimpleSignDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostSimpleSignDecoder openHTTPPostSimpleSignDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostSimpleSignDecoder decoder = new OpenHTTPPostSimpleSignDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint);
return decoder;
}
/**
* OpenHTTPPostDecoder.
* @return openHTTPPostDecoder
*/
@Bean(name = "openHTTPPostDecoder")
public OpenHTTPPostDecoder openHTTPPostDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostDecoder openHTTPPostDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPPostDecoder decoder = new OpenHTTPPostDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint);
return decoder;
}
/**
* OpenHTTPRedirectDecoder.
* @return openHTTPRedirectDecoder
*/
@Bean(name = "openHTTPRedirectDecoder")
public OpenHTTPRedirectDecoder openHTTPRedirectDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPRedirectDecoder openHTTPRedirectDecoder(BasicParserPool samlParserPool,
@Value("${maxkey.saml.v20.idp.receiver.endpoint}") String receiverEndpoint) {
OpenHTTPRedirectDecoder decoder = new OpenHTTPRedirectDecoder(samlParserPool);
decoder.setReceiverEndpoint(receiverEndpoint);
return decoder;
}
/**
* ExtractPostBindingAdapter.
* @return extractPostBindingAdapter
*/
@Bean(name = "extractPostBindingAdapter")
public ExtractPostBindingAdapter extractPostBindingAdapter(OpenHTTPPostDecoder openHTTPPostDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader,IssueInstantRule issueInstantRule,MessageReplayRule messageReplayRule) {
ExtractPostBindingAdapter extractPostBindingAdapter(OpenHTTPPostDecoder openHTTPPostDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader, IssueInstantRule issueInstantRule, MessageReplayRule messageReplayRule) {
ExtractPostBindingAdapter adapter = new ExtractPostBindingAdapter(openHTTPPostDecoder);
adapter.setIssueInstantRule(issueInstantRule);
adapter.setKeyStoreLoader(keyStoreLoader);
adapter.setMessageReplayRule(messageReplayRule);
return adapter;
}
/**
* ExtractRedirectBindingAdapter.
* @return extractRedirectBindingAdapter
*/
@Bean(name = "extractRedirectBindingAdapter")
public ExtractRedirectBindingAdapter extractRedirectBindingAdapter(OpenHTTPRedirectDecoder openHTTPRedirectDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader,IssueInstantRule issueInstantRule,MessageReplayRule messageReplayRule) {
ExtractRedirectBindingAdapter extractRedirectBindingAdapter(OpenHTTPRedirectDecoder openHTTPRedirectDecoder,
@Qualifier("keyStoreLoader") KeyStoreLoader keyStoreLoader, IssueInstantRule issueInstantRule, MessageReplayRule messageReplayRule) {
ExtractRedirectBindingAdapter adapter = new ExtractRedirectBindingAdapter(openHTTPRedirectDecoder);
adapter.setIssueInstantRule(issueInstantRule);
adapter.setKeyStoreLoader(keyStoreLoader);
adapter.setMessageReplayRule(messageReplayRule);
return adapter;
}
/**
* PostSimpleSignBindingAdapter.
* @return postSimpleSignBindingAdapter
*/
@Bean(name = "postSimpleSignBindingAdapter")
public PostSimpleSignBindingAdapter postSimpleSignBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostSimpleSignBindingAdapter postSimpleSignBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostSimpleSignBindingAdapter adapter = new PostSimpleSignBindingAdapter();
adapter.setVelocityEngine(velocityEngine);
adapter.setIssuerEntityName(issuerEntityName);
return adapter;
}
/**
* PostBindingAdapter.
* @return postBindingAdapter
*/
@Bean(name = "postBindingAdapter")
public PostBindingAdapter postBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostBindingAdapter postBindingAdapter(VelocityEngine velocityEngine,
@Value("${maxkey.saml.v20.idp.issuer}") String issuerEntityName) {
PostBindingAdapter adapter = new PostBindingAdapter();
adapter.setVelocityEngine(velocityEngine);
adapter.setIssuerEntityName(issuerEntityName);