diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthSdkTestHelper.m b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthSdkTestHelper.m index 6b33d7cf..3a406356 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthSdkTestHelper.m +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthSdkTestHelper.m @@ -776,6 +776,7 @@ - (BOOL) validateTokenHeader:(PowerAuthAuthorizationHttpHeader*)header validationRequest.tokenDigest = parsedHeader[@"token_digest"]; validationRequest.nonce = parsedHeader[@"nonce"]; validationRequest.timestamp = parsedHeader[@"timestamp"]; + validationRequest.protocolVersion = parsedHeader[@"version"]; PATSTokenValidationResponse * validationResponse = [_testServerApi validateTokenRequest:validationRequest]; XCTAssertTrue(validationResponse.tokenValid == expectedResult); if (expectedResult) { diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerAPI.m b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerAPI.m index bebab6d6..76d5e8a2 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerAPI.m +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerAPI.m @@ -54,6 +54,7 @@ - (BOOL) validateConnection return NO; } _testServerConfig.serverApiVersion = [_rest applyServerVersion:systemStatus.version]; + _testServerConfig.serverMaxProtovolVersion = PATSProtoVer(_testServerConfig.serverApiVersion); _serverVersion = _testServerConfig.serverApiVersion; NSArray* applicationList = [self getApplicationList]; @@ -346,7 +347,12 @@ - (BOOL) verifyECDSASignature:(NSString*)activationId data:(NSData*)data signatu - (PATSTokenValidationResponse*) validateTokenRequest:(PATSTokenValidationRequest*)request { [self checkForValidConnection]; - NSArray * params = @[ request.tokenIdentifier, request.tokenDigest, request.nonce, request.timestamp ]; + NSArray * params; + if (_testServerConfig.serverMaxProtovolVersion == PATS_P32) { + params = @[ request.tokenIdentifier, request.tokenDigest, request.nonce, request.timestamp, request.protocolVersion]; + } else { + params = @[ request.tokenIdentifier, request.tokenDigest, request.nonce, request.timestamp]; + } return [_rest request:@"TokenValidate" params:params]; } diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.h b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.h index 6ecd68bc..0187d25d 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.h +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.h @@ -40,6 +40,7 @@ typedef NS_ENUM(int, PowerAuthProtocolVersion) { PATS_P2, // V2 crypto PATS_P3, // V3 crypto PATS_P31, // V3.1 crypto + PATS_P32, // V3.2 crypto }; /** @@ -74,6 +75,10 @@ extern PowerAuthProtocolVersion PATSProtoVer(PowerAuthTestServerVersion serverVe "V2" is the default value. Loaded after the connection to server is established. */ @property (nonatomic, assign) PowerAuthTestServerVersion serverApiVersion; +/** + Maximum supported protocol version. + */ +@property (nonatomic, assign) PowerAuthProtocolVersion serverMaxProtovolVersion; /** A name for application, which will be used on the PA2 server. Default value is @"AutomaticTest-IOS" diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.m b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.m index c1cbf877..17352019 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.m +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerConfig.m @@ -53,6 +53,9 @@ + (instancetype) loadFromJsonFile:(NSString *)path PowerAuthProtocolVersion PATSProtoVer(PowerAuthTestServerVersion serverVer) { + if (serverVer >= PATS_V1_5) { + return PATS_P32; + } return PATS_P31; } diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerModel.h b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerModel.h index 2142263b..a2927c7a 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerModel.h +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/PowerAuthTestServerModel.h @@ -177,6 +177,7 @@ extern NSString * PATSActivationOtpValidationEnumToString(PATSActivationOtpValid @interface PATSTokenValidationRequest : NSObject +@property (nonatomic, strong) NSString * protocolVersion; @property (nonatomic, strong) NSString * tokenIdentifier; @property (nonatomic, strong) NSString * tokenDigest; @property (nonatomic, strong) NSString * nonce; diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v10.json b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v10.json index e0e759bc..66312b31 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v10.json +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v10.json @@ -4,13 +4,10 @@ "applicationName" ], "response": { - "class": "array", - "arrayClass": { - "class": "PATSApplication", - "properties": { - "applicationId": { "class" : "string" }, - "applicationName": { "class" : "string" } - } + "class": "PATSApplication", + "properties": { + "applicationId": { "class" : "string" }, + "applicationName": { "class" : "string" } } } -} \ No newline at end of file +} diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v13.json b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v13.json index 1f3323b0..bd3f24e3 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v13.json +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/CreateApplication_v13.json @@ -4,13 +4,10 @@ "applicationId" ], "response": { - "class": "array", - "arrayClass": { - "class": "PATSApplication", - "properties": { - "applicationId": { "class" : "string" }, - "applicationName": { "class" : "string", "key" : "applicationId" } - } + "class": "PATSApplication", + "properties": { + "applicationId": { "class" : "string" }, + "applicationName": { "class" : "string", "key" : "applicationId" } } } -} \ No newline at end of file +} diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/TokenValidate_v10.json b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/TokenValidate_v10.json new file mode 100644 index 00000000..9037ff8f --- /dev/null +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/TokenValidate_v10.json @@ -0,0 +1,19 @@ +{ + "path": "/rest/v3/token/validate", + "parameters": [ + "tokenId", + "tokenDigest", + "nonce", + "timestamp" + ], + "response": { + "class": "PATSTokenValidationResponse", + "properties": { + "tokenValid": { "class" : "bool" }, + "activationId": { "class" : "string" }, + "userId": { "class" : "string" }, + "applicationId": { "class" : "string" }, + "signatureType": { "class" : "string" } + } + } +} diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/TokenValidate_v15.json b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/TokenValidate_v15.json new file mode 100644 index 00000000..60f4c3b1 --- /dev/null +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/TokenValidate_v15.json @@ -0,0 +1,20 @@ +{ + "path": "/rest/v3/token/validate", + "parameters": [ + "tokenId", + "tokenDigest", + "nonce", + "timestamp", + "protocolVersion" + ], + "response": { + "class": "PATSTokenValidationResponse", + "properties": { + "tokenValid": { "class" : "bool" }, + "activationId": { "class" : "string" }, + "userId": { "class" : "string" }, + "applicationId": { "class" : "string" }, + "signatureType": { "class" : "string" } + } + } +} diff --git a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/mappings.json b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/mappings.json index db7ac159..ce3f4458 100644 --- a/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/mappings.json +++ b/proj-xcode/PowerAuth2IntegrationTests/PowerAuthServer/RestEndpoints.bundle/mappings.json @@ -19,7 +19,8 @@ "GetApplicationDetail": "GetApplicationDetail_v10", "CreateApplicationVersion": "CreateApplicationVersion_v10", "SupportApplicationVersion": "SupportApplicationVersion_v10", - "UnsupportApplicationVersion": "UnsupportApplicationVersion_v10" + "UnsupportApplicationVersion": "UnsupportApplicationVersion_v10", + "TokenValidate": "TokenValidate_v10" }, "v13": { "GetApplicationList": "GetApplicationList_v13", @@ -27,11 +28,13 @@ "GetApplicationDetail": "GetApplicationDetail_v13", "CreateApplicationVersion": "CreateApplicationVersion_v13", "SupportApplicationVersion": "SupportApplicationVersion_v13", - "UnsupportApplicationVersion": "UnsupportApplicationVersion_v13" + "UnsupportApplicationVersion": "UnsupportApplicationVersion_v13", + "TokenValidate": "TokenValidate_v10" }, "v15": { "#base": "v13", "GetApplicationDetail": "GetApplicationDetail_v15", - "CreateApplicationVersion": "CreateApplicationVersion_v15" + "CreateApplicationVersion": "CreateApplicationVersion_v15", + "TokenValidate": "TokenValidate_v15" } } }