Class WebClientFactoryBean
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<WebClient>
se.swedenconnect.bankid.rpapi.support.WebClientFactoryBean
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,DisposableBean,FactoryBean<WebClient>,InitializingBean
Spring factory class for configuring and creating a
WebClient instance that can be used to communicate with
the BankID server.- Author:
- Martin Lindström
-
Field Summary
FieldsModifier and TypeFieldDescriptionA resource pointing at the server TLS root certificate for production.static final StringThe BankID webservice URL (production).A resource pointing at the server TLS root certificate for production.static final Stringstatic final Stringstatic final StringThe BankID webservice URL (test).Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
loggerFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionWebClientFactoryBean(String webServiceUrl, Resource trustedRoot, PkiCredential rpCredential) Creates a factory bean for creatingWebClients. -
Method Summary
Modifier and TypeMethodDescriptionstatic WebClientFactoryBeanforProduction(PkiCredential rpCredential) Creates aWebClientFactoryBeanwith thewebServiceUrlset toPRODUCTION_WEB_SERVICE_URLand thetrustedRootset toPRODUCTION_ROOT_CERTIFICATE.static WebClientFactoryBeanforTest()Creates aWebClientFactoryBeanwith thewebServiceUrlset toTEST_WEB_SERVICE_URL, thetrustedRootset toTEST_ROOT_CERTIFICATEand the credentials loaded fromTEST_RP_CREDENTIAL.static WebClientFactoryBeanforTest(PkiCredential rpCredential) Creates aWebClientFactoryBeanwith thewebServiceUrlset toTEST_WEB_SERVICE_URLand thetrustedRootset toTEST_ROOT_CERTIFICATE.Class<?> voidsetWebClientBuilder(WebClient.Builder webClientBuilder) Assigns theWebClient.Builderto use.Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Field Details
-
PRODUCTION_WEB_SERVICE_URL
The BankID webservice URL (production).- See Also:
-
TEST_WEB_SERVICE_URL
The BankID webservice URL (test).- See Also:
-
PRODUCTION_ROOT_CERTIFICATE
A resource pointing at the server TLS root certificate for production. -
TEST_ROOT_CERTIFICATE
A resource pointing at the server TLS root certificate for production. -
TEST_RP_CREDENTIAL_LOCATION
- See Also:
-
TEST_RP_CREDENTIAL
-
TEST_RP_CREDENTIAL_PASSWORD
- See Also:
-
-
Constructor Details
-
WebClientFactoryBean
Creates a factory bean for creatingWebClients.- Parameters:
webServiceUrl- the web service URL to the BankID server - defaults toPRODUCTION_WEB_SERVICE_URLtrustedRoot- the resource to the root certificate that we trust when verifying the BankID server certificate - defaults toPRODUCTION_ROOT_CERTIFICATErpCredential- the credential holding the client TLS key and certificate (BankID relying party certificate)
-
-
Method Details
-
forProduction
Creates aWebClientFactoryBeanwith thewebServiceUrlset toPRODUCTION_WEB_SERVICE_URLand thetrustedRootset toPRODUCTION_ROOT_CERTIFICATE.- Parameters:
rpCredential- the credential holding the client TLS key and certificate (BankID relying party certificate)- Returns:
- a
WebClientFactoryBean
-
forTest
Creates aWebClientFactoryBeanwith thewebServiceUrlset toTEST_WEB_SERVICE_URLand thetrustedRootset toTEST_ROOT_CERTIFICATE.- Parameters:
rpCredential- the credential holding the client TLS key and certificate (BankID relying party certificate)- Returns:
- a
WebClientFactoryBean
-
forTest
Creates aWebClientFactoryBeanwith thewebServiceUrlset toTEST_WEB_SERVICE_URL, thetrustedRootset toTEST_ROOT_CERTIFICATEand the credentials loaded fromTEST_RP_CREDENTIAL.- Returns:
- a
WebClientFactoryBean
-
getObjectType
- Specified by:
getObjectTypein interfaceFactoryBean<WebClient>- Specified by:
getObjectTypein classAbstractFactoryBean<WebClient>
-
createInstance
- Specified by:
createInstancein classAbstractFactoryBean<WebClient>- Throws:
Exception
-
setWebClientBuilder
Assigns theWebClient.Builderto use. Defaults toWebClient.builder().- Parameters:
webClientBuilder- a builder
-