diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs
index 56f05e69566..22869a48280 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs
@@ -29,7 +29,7 @@
-
@@ -72,4 +72,4 @@
{{/zone}}
{{#zone "bottomJs"}}
{{js "js/script.js"}}
-{{/zone}}
\ No newline at end of file
+{{/zone}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js
index 346b81df46f..e3e4224eda1 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js
@@ -1,7 +1,21 @@
function onRequest(context) {
var Encode = Packages.org.owasp.encoder.Encode;
var viewModel = {};
- viewModel.appName = Encode.forHtml(request.getParameter("sp"));
+
+ // if sp is received, its a saml request or else its oidc
+ if(request.getParameter("sp") !== null) {
+ viewModel.appName = Encode.forHtml(request.getParameter("sp"));
+ viewModel.action = "/commonauth";
+ viewModel.sessionDataKey = Encode.forHtmlAttribute(request.getParameter("sessionDataKey"));
+ viewModel.sessionDataKeyName = "sessionDataKey";
+ viewModel.ssoProtocol = "saml";
+ } else {
+ viewModel.appName = Encode.forHtml(request.getParameter("application"));
+ viewModel.action = "../oauth2/authorize";
+ viewModel.sessionDataKey = Encode.forHtmlAttribute(request.getParameter("sessionDataKeyConsent"));
+ viewModel.sessionDataKeyName = "sessionDataKeyConsent";
+ viewModel.ssoProtocol = "oidc";
+ }
var mandatoryClaims = [];
var requestedClaims = [];
var singleMandatoryClaim = false;
@@ -36,6 +50,5 @@ function onRequest(context) {
viewModel.mandatoryClaims = mandatoryClaims;
viewModel.requestedClaims = requestedClaims;
viewModel.singleMandatoryClaim = singleMandatoryClaim;
- viewModel.sessionDataKey = Encode.forHtmlAttribute(request.getParameter("sessionDataKey"));
return viewModel;
-}
\ No newline at end of file
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js
index 8588c004a9f..7f6fff8d8bc 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js
@@ -1,9 +1,13 @@
-function approved() {
+function approved(ssoProtocol) {
var mandatoryClaimCBs = $(".mandatory-claim");
var checkedMandatoryClaimCBs = $(".mandatory-claim:checked");
if (checkedMandatoryClaimCBs.length == mandatoryClaimCBs.length) {
- document.getElementById('consent').value = "approve";
+ if(ssoProtocol === "saml") {
+ document.getElementById('consent').value = "approve";
+ } else if(ssoProtocol === "oidc") {
+ document.getElementById('consent').value = "approveAlways";
+ }
document.getElementById("consentForm").submit();
} else {
$("#modal_claim_validation").modal();
@@ -32,4 +36,4 @@ $(document).ready(function () {
$("#consent_select_all").prop("checked", false);
}
});
-});
\ No newline at end of file
+});