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
Modifier and TypeFieldDescriptionA resource pointing at the server TLS root certificate for production.static final String
The BankID webservice URL (production).A resource pointing at the server TLS root certificate for production.static final String
static final String
The BankID webservice URL (test).Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
ConstructorDescriptionWebClientFactoryBean
(String webServiceUrl, Resource trustedRoot, PkiCredential rpCredential) Creates a factory bean for creatingWebClient
s. -
Method Summary
Modifier and TypeMethodDescriptionstatic WebClientFactoryBean
forProduction
(PkiCredential rpCredential) Creates aWebClientFactoryBean
with thewebServiceUrl
set toPRODUCTION_WEB_SERVICE_URL
and thetrustedRoot
set toPRODUCTION_ROOT_CERTIFICATE
.static WebClientFactoryBean
forTest()
Creates aWebClientFactoryBean
with thewebServiceUrl
set toTEST_WEB_SERVICE_URL
, thetrustedRoot
set toTEST_ROOT_CERTIFICATE
and the credentials loaded fromTEST_RP_CREDENTIAL
.static WebClientFactoryBean
forTest
(PkiCredential rpCredential) Creates aWebClientFactoryBean
with thewebServiceUrl
set toTEST_WEB_SERVICE_URL
and thetrustedRoot
set toTEST_ROOT_CERTIFICATE
.Class
<?> void
setWebClientBuilder
(WebClient.Builder webClientBuilder) Assigns theWebClient.Builder
to 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
-
TEST_RP_CREDENTIAL_PASSWORD
- See Also:
-
-
Constructor Details
-
WebClientFactoryBean
Creates a factory bean for creatingWebClient
s.- Parameters:
webServiceUrl
- the web service URL to the BankID server - defaults toPRODUCTION_WEB_SERVICE_URL
trustedRoot
- the resource to the root certificate that we trust when verifying the BankID server certificate - defaults toPRODUCTION_ROOT_CERTIFICATE
rpCredential
- the credential holding the client TLS key and certificate (BankID relying party certificate)
-
-
Method Details
-
forProduction
Creates aWebClientFactoryBean
with thewebServiceUrl
set toPRODUCTION_WEB_SERVICE_URL
and thetrustedRoot
set toPRODUCTION_ROOT_CERTIFICATE
.- Parameters:
rpCredential
- the credential holding the client TLS key and certificate (BankID relying party certificate)- Returns:
- a
WebClientFactoryBean
-
forTest
Creates aWebClientFactoryBean
with thewebServiceUrl
set toTEST_WEB_SERVICE_URL
and thetrustedRoot
set toTEST_ROOT_CERTIFICATE
.- Parameters:
rpCredential
- the credential holding the client TLS key and certificate (BankID relying party certificate)- Returns:
- a
WebClientFactoryBean
-
forTest
Creates aWebClientFactoryBean
with thewebServiceUrl
set toTEST_WEB_SERVICE_URL
, thetrustedRoot
set toTEST_ROOT_CERTIFICATE
and the credentials loaded fromTEST_RP_CREDENTIAL
.- Returns:
- a
WebClientFactoryBean
-
getObjectType
- Specified by:
getObjectType
in interfaceFactoryBean<WebClient>
- Specified by:
getObjectType
in classAbstractFactoryBean<WebClient>
-
createInstance
- Specified by:
createInstance
in classAbstractFactoryBean<WebClient>
- Throws:
Exception
-
setWebClientBuilder
Assigns theWebClient.Builder
to use. Defaults toWebClient.builder()
.- Parameters:
webClientBuilder
- a builder
-