-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add complex payload unit tests for HTTP Post functions
- Loading branch information
1 parent
ce935a3
commit f431671
Showing
4 changed files
with
161 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...es/org/wso2/carbon/identity/conditional/auth/functions/http/http-post-payload-test-sp.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!-- | ||
~ Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org). | ||
~ | ||
~ WSO2 Inc. licenses this file to you under the Apache License, | ||
~ Version 2.0 (the "License"); you may not use this file except | ||
~ in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
<ServiceProvider> | ||
<ApplicationID>1</ApplicationID> | ||
<ApplicationName>default</ApplicationName> | ||
<Description>Default Service Provider</Description> | ||
<InboundAuthenticationConfig> | ||
<InboundAuthenticationRequestConfigs> | ||
<InboundAuthenticationRequestConfig> | ||
<InboundAuthKey>default</InboundAuthKey> | ||
<InboundAuthType></InboundAuthType> | ||
<Properties></Properties> | ||
</InboundAuthenticationRequestConfig> | ||
</InboundAuthenticationRequestConfigs> | ||
</InboundAuthenticationConfig> | ||
<LocalAndOutBoundAuthenticationConfig> | ||
<AuthenticationSteps> | ||
<AuthenticationStep> | ||
<StepOrder>1</StepOrder> | ||
<LocalAuthenticatorConfigs> | ||
<LocalAuthenticatorConfig> | ||
<Name>BasicMockAuthenticator</Name> | ||
<DisplayName>basicauth</DisplayName> | ||
<IsEnabled>true</IsEnabled> | ||
</LocalAuthenticatorConfig> | ||
</LocalAuthenticatorConfigs> | ||
<SubjectStep>true</SubjectStep> | ||
<AttributeStep>true</AttributeStep> | ||
</AuthenticationStep> | ||
</AuthenticationSteps> | ||
<AuthenticationScript type="application/javascript" enabled="true"><![CDATA[ | ||
function onLoginRequest(context) { | ||
var comprehensivePayload = %s; | ||
httpPost('%s', comprehensivePayload, { | ||
onSuccess : function(context, data) { | ||
Log.info('httpPost call success'); | ||
context.selectedAcr = data.status; | ||
executeStep(1); | ||
}, onFail : function(context, data) { | ||
Log.info('httpPost call failed'); | ||
context.selectedAcr = 'FAILED'; | ||
executeStep(1); | ||
} | ||
}); | ||
} | ||
]]></AuthenticationScript> | ||
<AuthenticationType>flow</AuthenticationType> | ||
</LocalAndOutBoundAuthenticationConfig> | ||
<RequestPathAuthenticatorConfigs></RequestPathAuthenticatorConfigs> | ||
<InboundProvisioningConfig></InboundProvisioningConfig> | ||
<OutboundProvisioningConfig></OutboundProvisioningConfig> | ||
<ClaimConfig> | ||
<AlwaysSendMappedLocalSubjectId>true</AlwaysSendMappedLocalSubjectId> | ||
</ClaimConfig> | ||
<PermissionAndRoleConfig></PermissionAndRoleConfig> | ||
</ServiceProvider> |
39 changes: 39 additions & 0 deletions
39
...resources/org/wso2/carbon/identity/conditional/auth/functions/http/http-post-payload.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"stringKey": "stringValue", | ||
"numberKey": 123, | ||
"booleanKey": true, | ||
"arrayKey": [ | ||
"arrayString", | ||
456, | ||
false, | ||
{ | ||
"nestedObjectInArrayKey": "nestedObjectValue", | ||
"nestedArrayInArrayKey": ["nestedArrayValue1", "nestedArrayValue2"] | ||
} | ||
], | ||
"objectKey": { | ||
"objectStringKey": "objectStringValue", | ||
"objectNumberKey": 789, | ||
"objectBooleanKey": false, | ||
"nestedObjectKey": { | ||
"nestedObjectStringKey": "nestedObjectStringValue", | ||
"nestedObjectArrayKey": [ | ||
"nestedArrayValue1", | ||
101112, | ||
true | ||
] | ||
}, | ||
"arrayOfObjectsKey": [ | ||
{ | ||
"arrayOfObjectsStringKey": "arrayOfObjectsStringValue1", | ||
"arrayOfObjectsNumberKey": 131415, | ||
"arrayOfObjectsBooleanKey": true | ||
}, | ||
{ | ||
"arrayOfObjectsStringKey": "arrayOfObjectsStringValue2", | ||
"arrayOfObjectsNumberKey": 161718, | ||
"arrayOfObjectsBooleanKey": false | ||
} | ||
] | ||
} | ||
} |