[fix][auth]Fix user registration and resetPassword issue.
Some checks are pending
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run

This commit is contained in:
jerryjzhang
2025-02-13 23:37:18 +08:00
parent 89e07509de
commit 6cc145935d
16 changed files with 81 additions and 77 deletions

View File

@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static dev.langchain4j.opensearch.spring.Properties.PREFIX;
@Configuration
@EnableConfigurationProperties(dev.langchain4j.opensearch.spring.Properties.class)
public class OpenSearchAutoConfig {

View File

@@ -11,11 +11,12 @@ import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
import org.apache.hc.core5.http.HttpHost;
import org.opensearch.client.transport.aws.AwsSdk2TransportOptions;
import org.springframework.beans.BeanUtils;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import java.net.URI;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
/**
* @author zyc
*/
@@ -42,18 +43,16 @@ public class OpenSearchEmbeddingStoreFactory extends BaseEmbeddingStoreFactory {
@Override
public EmbeddingStore<TextSegment> createEmbeddingStore(String collectionName) {
final AwsSdk2TransportOptions options = AwsSdk2TransportOptions.builder()
.setCredentials(StaticCredentialsProvider.create(AwsBasicCredentials.create(storeProperties.getUser(), storeProperties.getPassword())))
.build();
final AwsSdk2TransportOptions options =
AwsSdk2TransportOptions.builder()
.setCredentials(StaticCredentialsProvider.create(AwsBasicCredentials
.create(storeProperties.getUser(), storeProperties.getPassword())))
.build();
final String indexName = storeProperties.getDatabaseName() + "_" + collectionName;
return OpenSearchEmbeddingStore.builder().serviceName(storeProperties.getServiceName())
.serverUrl(storeProperties.getUri())
.region(storeProperties.getRegion())
.indexName(indexName)
.userName(storeProperties.getUser())
.password(storeProperties.getPassword())
.apiKey(storeProperties.getToken())
.options(options)
.build();
.serverUrl(storeProperties.getUri()).region(storeProperties.getRegion())
.indexName(indexName).userName(storeProperties.getUser())
.password(storeProperties.getPassword()).apiKey(storeProperties.getToken())
.options(options).build();
}
}