-
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 unit tests for Call Choreo and Call Analytics functions for compr…
…ehensive payload
- Loading branch information
1 parent
ef3139e
commit e4d664f
Showing
10 changed files
with
570 additions
and
72 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
124 changes: 124 additions & 0 deletions
124
...g/wso2/carbon/identity/conditional/auth/functions/analytics/analytics-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,124 @@ | ||
<!-- | ||
~ Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. | ||
~ | ||
~ WSO2 LLC. 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> | ||
<AuthenticationStep> | ||
<StepOrder>2</StepOrder> | ||
<FederatedIdentityProviders> | ||
<IdentityProvider> | ||
<IdentityProviderName>HwkMockAuthenticator</IdentityProviderName> | ||
<IsEnabled>true</IsEnabled> | ||
<DefaultAuthenticatorConfig>HwkMockAuthenticator</DefaultAuthenticatorConfig> | ||
<FederatedAuthenticatorConfigs> | ||
<FederatedAuthenticatorConfig> | ||
<Name>HwkMockAuthenticator</Name> | ||
<IsEnabled>true</IsEnabled> | ||
</FederatedAuthenticatorConfig> | ||
</FederatedAuthenticatorConfigs> | ||
</IdentityProvider> | ||
</FederatedIdentityProviders> | ||
<SubjectStep>false</SubjectStep> | ||
<AttributeStep>false</AttributeStep> | ||
</AuthenticationStep> | ||
<AuthenticationStep> | ||
<StepOrder>3</StepOrder> | ||
<FederatedIdentityProviders> | ||
<IdentityProvider> | ||
<IdentityProviderName>FptMockAuthenticator</IdentityProviderName> | ||
<IsEnabled>true</IsEnabled> | ||
<DefaultAuthenticatorConfig>FptMockAuthenticator</DefaultAuthenticatorConfig> | ||
<FederatedAuthenticatorConfigs> | ||
<FederatedAuthenticatorConfig> | ||
<Name>FptMockAuthenticator</Name> | ||
<IsEnabled>true</IsEnabled> | ||
</FederatedAuthenticatorConfig> | ||
</FederatedAuthenticatorConfigs> | ||
</IdentityProvider> | ||
</FederatedIdentityProviders> | ||
<SubjectStep>false</SubjectStep> | ||
<AttributeStep>false</AttributeStep> | ||
</AuthenticationStep> | ||
<AuthenticationStep> | ||
<StepOrder>4</StepOrder> | ||
<LocalAuthenticatorConfigs> | ||
<LocalAuthenticatorConfig> | ||
<Name>MockFallbackAuthenticator</Name> | ||
<DisplayName>basicauthfallback</DisplayName> | ||
<IsEnabled>true</IsEnabled> | ||
</LocalAuthenticatorConfig> | ||
</LocalAuthenticatorConfigs> | ||
<SubjectStep>true</SubjectStep> | ||
<AttributeStep>true</AttributeStep> | ||
</AuthenticationStep> | ||
</AuthenticationSteps> | ||
<AuthenticationScript type="application/javascript" enabled="true"><![CDATA[ | ||
var comprehensivePayload = %s; | ||
function onLoginRequest(context) { | ||
executeStep(1, { | ||
onSuccess: function (context) { | ||
var username = context.steps[1].subject.username; | ||
callAnalytics({'ReceiverUrl': '%s'}, comprehensivePayload, { | ||
onSuccess: function (context, data) { | ||
if (data.event.riskScore > 0) { | ||
Log.info('data.event.riskScore > 0'); | ||
context.selectedAcr = ''+ data.event.riskScore; | ||
} | ||
}, onFail: function (context, data) { | ||
Log.info('fail Called'); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
]]></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
...rces/org/wso2/carbon/identity/conditional/auth/functions/analytics/analytics-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 | ||
} | ||
] | ||
} | ||
} |
Oops, something went wrong.