Skip to content

Commit f224ab0

Browse files
committed
SDK-2771: Add NoAuthStrategy to be used on endpoints that don't require any authentication
1 parent 7d85db6 commit f224ab0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

yoti-sdk-api/src/main/java/com/yoti/api/client/docs/DocScanService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.yoti.api.client.spi.remote.call.YotiHttpRequestBuilderFactory;
3838
import com.yoti.api.client.spi.remote.call.YotiHttpResponse;
3939
import com.yoti.api.client.spi.remote.call.factory.AuthStrategy;
40+
import com.yoti.api.client.spi.remote.call.factory.NoAuthStrategy;
4041
import com.yoti.api.client.spi.remote.call.factory.UnsignedPathFactory;
4142

4243
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -474,6 +475,7 @@ SupportedDocumentsResponse getSupportedDocuments(boolean includeNonLatin) throws
474475

475476
try {
476477
YotiHttpRequest yotiHttpRequest = yotiHttpRequestBuilderFactory.create()
478+
.withAuthStrategy(new NoAuthStrategy())
477479
.withBaseUrl(apiUrl)
478480
.withEndpoint(path)
479481
.withHttpMethod(HTTP_GET)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.yoti.api.client.spi.remote.call.factory;
2+
3+
import java.security.GeneralSecurityException;
4+
import java.util.Collections;
5+
import java.util.List;
6+
7+
import org.apache.http.Header;
8+
import org.apache.http.NameValuePair;
9+
10+
public class NoAuthStrategy implements AuthStrategy {
11+
12+
@Override
13+
public List<Header> createAuthHeaders(String httpMethod, String endpoint, byte[] payload) throws GeneralSecurityException {
14+
return Collections.emptyList();
15+
}
16+
17+
@Override
18+
public List<NameValuePair> createQueryParams() {
19+
return Collections.emptyList();
20+
}
21+
22+
}

0 commit comments

Comments
 (0)