-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntegrationInitializer.java
More file actions
27 lines (21 loc) · 974 Bytes
/
IntegrationInitializer.java
File metadata and controls
27 lines (21 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.company.clientapp.security;
import io.jmix.restds.impl.RestPasswordAuthenticator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
@Component
public class IntegrationInitializer {
@Value("${integration.store}")
private String integrationStore;
@Value("${integration.user.username}")
private String integrationUser;
@Value("${integration.user.password}")
private String integrationPassword;
@EventListener
public void onApplicationStarted(final ApplicationStartedEvent event) {
RestPasswordAuthenticator authenticator = event.getApplicationContext().getBean(RestPasswordAuthenticator.class);
authenticator.setDataStoreName(integrationStore);
authenticator.authenticate(integrationUser, integrationPassword);
}
}