Skip to content

Commit

Permalink
Merge pull request #598 from wultra/issues/cherry-picks-from-1.8-to-1.7
Browse files Browse the repository at this point in the history
Cherry picksfrom 1.8.x to 1.7.x
  • Loading branch information
hvge authored Jun 10, 2024
2 parents 8a07fae + d9ddcf8 commit 2815f09
Show file tree
Hide file tree
Showing 50 changed files with 2,373 additions and 54 deletions.
9 changes: 8 additions & 1 deletion proj-android/PowerAuthLibrary/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@
<init>(...);
<fields>;
}
-keep class io.getlime.security.powerauth.ecies.EciesMetadata {
<fields>;
}
-keep class io.getlime.security.powerauth.sdk.impl.PowerAuthPrivateTokenData {
<fields>;
}
-keepclassmembers class io.getlime.core.rest.model.** {
<fields>;
}
-keepclassmembers class io.getlime.security.powerauth.networking.model.** {
# necessary for R8 fullMode
-keep, allowobfuscation class io.getlime.core.rest.model.**

-keep class io.getlime.security.powerauth.networking.model.** {
<fields>;
}

Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public interface Execution<TResult> {
* Start your asynchronous operation. Your implementation get a {@link ResultCatcher} object
* that allows you report result of the operation once it completes its execution.
*
* @param resultCatcher A result catcher that allows you report the result of the asynchronous operation.
* @param resultCatcher A result catcher that allows you to report the result of the asynchronous operation.
* @throws Exception In case of failure.
*/
void execute(@NonNull ResultCatcher<TResult> resultCatcher) throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public interface PowerAuthServerApi {
* Get information about activation.
*
* @param activationId Activation identifier.
* @param challenge Optional challenge, required for acquiring V3.1 {@code encryptedStatusBlob}.
* @param challenge Optional challenge, required for acquiring V3.1+ {@code encryptedStatusBlob}.
* @return {@link ActivationDetail} object.
* @throws Exception In case of failure.
*/
Expand All @@ -272,10 +272,11 @@ public interface PowerAuthServerApi {
* @param tokenDigest Token digest.
* @param nonce Nonce in Base64 encoding.
* @param timestamp Timestamp used for calculate token.
* @param protocolVersion Protocol version, required for server 1.5+.
* @return {@link TokenInfo} object in case of success.
* @throws Exception In case of failure.
*/
@NonNull TokenInfo validateToken(@NonNull String tokenId, @NonNull String tokenDigest, @NonNull String nonce, long timestamp) throws Exception;
@NonNull TokenInfo validateToken(@NonNull String tokenId, @NonNull String tokenDigest, @NonNull String nonce, long timestamp, @NonNull String protocolVersion) throws Exception;

// Signatures

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.getlime.security.powerauth.integration.support.model.Application;
import io.getlime.security.powerauth.integration.support.model.ApplicationDetail;
import io.getlime.security.powerauth.integration.support.model.ApplicationVersion;
import io.getlime.security.powerauth.integration.support.model.ProtocolVersion;
import io.getlime.security.powerauth.networking.ssl.HttpClientSslNoValidationStrategy;
import io.getlime.security.powerauth.sdk.PowerAuthAuthenticationHelper;
import io.getlime.security.powerauth.sdk.PowerAuthClientConfiguration;
Expand Down Expand Up @@ -483,6 +484,6 @@ private PowerAuthTestHelper(
* @return Expected protocol version for HTTP headers.
*/
public @NonNull String getProtocolVersionForHeader() {
return testConfig.getServerVersion().maxProtocolVersion.versionForHeader;
return ProtocolVersion.V3_1.versionForHeader;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.getlime.security.powerauth.integration.support.model.ServerVersion;
import io.getlime.security.powerauth.integration.support.v10.PowerAuthClientV3_ServerV10;
import io.getlime.security.powerauth.integration.support.v13.PowerAuthClientV3_ServerV13;
import io.getlime.security.powerauth.integration.support.v15.PowerAuthClientV3_ServerV15;

/**
* The {@code PowerAuthClientFactory} provides client that communicate with PowerAuth Server API,
Expand All @@ -40,12 +41,13 @@ public class PowerAuthClientFactory {
*/
public PowerAuthServerApi createApiClient(@NonNull PowerAuthTestConfig testConfig) throws Exception {
PowerAuthServerApi api = null;
if (testConfig.getServerVersion().numericVersion >= ServerVersion.V1_0_0.numericVersion &&
testConfig.getServerVersion().numericVersion <= ServerVersion.V1_2_5.numericVersion) {
final int numVer = testConfig.getServerVersion().numericVersion;
if (numVer >= ServerVersion.V1_0_0.numericVersion && numVer < ServerVersion.V1_3_0.numericVersion) {
api = new PowerAuthClientV3_ServerV10(testConfig.getServerApiUrl(), testConfig.getAuthorizationHeaderValue(), ServerVersion.V1_0_0, ServerVersion.V1_2_5);
} else if (testConfig.getServerVersion().numericVersion >= ServerVersion.V1_3_0.numericVersion &&
testConfig.getServerVersion().numericVersion <= ServerVersion.LATEST.numericVersion) {
api = new PowerAuthClientV3_ServerV13(testConfig.getServerApiUrl(), testConfig.getAuthorizationHeaderValue(), ServerVersion.V1_3_0, null);
} else if (numVer >= ServerVersion.V1_3_0.numericVersion && numVer < ServerVersion.V1_5_0.numericVersion) {
api = new PowerAuthClientV3_ServerV13(testConfig.getServerApiUrl(), testConfig.getAuthorizationHeaderValue(), ServerVersion.V1_3_0, ServerVersion.V1_4_0);
} else if (numVer >= ServerVersion.V1_5_0.numericVersion && numVer <= ServerVersion.LATEST.numericVersion) {
api = new PowerAuthClientV3_ServerV15(testConfig.getServerApiUrl(), testConfig.getAuthorizationHeaderValue(), ServerVersion.V1_5_0, null);
}
if (api == null) {
throw new Exception("Missing implementation for server API, for server version " + testConfig.getServerVersion().version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ApplicationVersion {
private String applicationVersionName;
private String applicationKey;
private String applicationSecret;
private String mobileSdkConfig;
private boolean supported;

public String getApplicationVersionId() {
Expand Down Expand Up @@ -63,4 +64,12 @@ public boolean isSupported() {
public void setSupported(boolean supported) {
this.supported = supported;
}

public String getMobileSdkConfig() {
return mobileSdkConfig;
}

public void setMobileSdkConfig(String mobileSdkConfig) {
this.mobileSdkConfig = mobileSdkConfig;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ public enum ProtocolVersion {
V2(20, "2.0"),
V2_1(21, "2.1"),
V3(30, "3.0"),
V3_1(31, "3.1");
V3_1(31, "3.1"),
V3_2(32, "3.2");

public int version;
public String versionForHeader;
public final int version;
public final String versionForHeader;

ProtocolVersion(int version, String versionForHeader) {
this.version = version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ public enum ServerVersion {
V1_2_5("1.2.5", 1002005, ProtocolVersion.V3_1),
V1_3_0("1.3", 1003000, ProtocolVersion.V3_1),
V1_4_0("1.4", 1004000, ProtocolVersion.V3_1),
V1_5_0("1.5", 1005000, ProtocolVersion.V3_1),
V1_5_0("1.5", 1005000, ProtocolVersion.V3_2),
V1_6_0("1.6", 1006000, ProtocolVersion.V3_2),
V1_7_0("1.7", 1007000, ProtocolVersion.V3_2),
V1_8_0("1.8", 1008000, ProtocolVersion.V3_2),

;

/**
* Contains constant for the latest PowerAuth Server version.
*/
public static final ServerVersion LATEST = V1_5_0;
public static final ServerVersion LATEST = V1_8_0;

/**
* Server version represented as string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public ActivationDetail getActivationDetail(@NonNull Activation activation) thro

@NonNull
@Override
public TokenInfo validateToken(@NonNull String tokenId, @NonNull String tokenDigest, @NonNull String nonce, long timestamp) throws Exception {
public TokenInfo validateToken(@NonNull String tokenId, @NonNull String tokenDigest, @NonNull String nonce, long timestamp, @NonNull String protocolVersion) throws Exception {
final ValidateTokenEndpoint.Request request = new ValidateTokenEndpoint.Request();
request.setTokenId(tokenId);
request.setTokenDigest(tokenDigest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public ActivationDetail getActivationDetail(@NonNull Activation activation) thro

@NonNull
@Override
public TokenInfo validateToken(@NonNull String tokenId, @NonNull String tokenDigest, @NonNull String nonce, long timestamp) throws Exception {
public TokenInfo validateToken(@NonNull String tokenId, @NonNull String tokenDigest, @NonNull String nonce, long timestamp, @NonNull String protocolVersion) throws Exception {
final ValidateTokenEndpoint.Request request = new ValidateTokenEndpoint.Request();
request.setTokenId(tokenId);
request.setTokenDigest(tokenDigest);
Expand Down
Loading

0 comments on commit 2815f09

Please sign in to comment.