diff --git a/open-banking-accelerator/components/com.wso2.openbanking.accelerator.identity/src/main/java/com/wso2/openbanking/accelerator/identity/claims/RoleClaimProviderImpl.java b/open-banking-accelerator/components/com.wso2.openbanking.accelerator.identity/src/main/java/com/wso2/openbanking/accelerator/identity/claims/RoleClaimProviderImpl.java index a0612685..91a8302f 100644 --- a/open-banking-accelerator/components/com.wso2.openbanking.accelerator.identity/src/main/java/com/wso2/openbanking/accelerator/identity/claims/RoleClaimProviderImpl.java +++ b/open-banking-accelerator/components/com.wso2.openbanking.accelerator.identity/src/main/java/com/wso2/openbanking/accelerator/identity/claims/RoleClaimProviderImpl.java @@ -51,7 +51,8 @@ public class RoleClaimProviderImpl implements ClaimProvider { private static final String USER_ROLE = "user_role"; private static final String OPENID_SCOPE = "openid"; private static final String CUSTOMER_CARE_OFFICER = "customerCareOfficer"; - private static final String CUSTOMER_CARE_OFFICER_ROLE = "Internal/CustomerCareOfficerRole"; + private static final String INTERNAL_CUSTOMER_CARE_OFFICER_ROLE = "Internal/CustomerCareOfficerRole"; + private static final String INTERNAL_CUSTOMER_CARE_OFFICER = "Internal/CustomerCareOfficer"; private static final String CUSTOMER_CARE_OFFICER_SCOPE = "consents:read_all"; @Generated(message = "Do not contain logics") @@ -86,7 +87,8 @@ public Map getAdditionalClaims(OAuthTokenReqMessageContext oAuth UserStoreManager userStoreManager = realmService.getTenantUserRealm(tenantId).getUserStoreManager(); String[] roles = userStoreManager.getRoleListOfUser(userId); - if (ArrayUtils.contains(roles, CUSTOMER_CARE_OFFICER_ROLE)) { + if (ArrayUtils.contains(roles, INTERNAL_CUSTOMER_CARE_OFFICER_ROLE) || ArrayUtils.contains(roles, + INTERNAL_CUSTOMER_CARE_OFFICER)) { claims.put(USER_ROLE, CUSTOMER_CARE_OFFICER); } } catch (IdentityRuntimeException e) { diff --git a/open-banking-accelerator/components/consent-management/com.wso2.openbanking.accelerator.consent.mgt.service/src/main/java/com/wso2/openbanking/accelerator/consent/mgt/service/impl/ConsentCoreServiceImpl.java b/open-banking-accelerator/components/consent-management/com.wso2.openbanking.accelerator.consent.mgt.service/src/main/java/com/wso2/openbanking/accelerator/consent/mgt/service/impl/ConsentCoreServiceImpl.java index 0a8f0504..8739948e 100644 --- a/open-banking-accelerator/components/consent-management/com.wso2.openbanking.accelerator.consent.mgt.service/src/main/java/com/wso2/openbanking/accelerator/consent/mgt/service/impl/ConsentCoreServiceImpl.java +++ b/open-banking-accelerator/components/consent-management/com.wso2.openbanking.accelerator.consent.mgt.service/src/main/java/com/wso2/openbanking/accelerator/consent/mgt/service/impl/ConsentCoreServiceImpl.java @@ -367,7 +367,10 @@ public boolean revokeConsentWithReason(String consentID, String revokedConsentSt " is not a member of the consent user list"); throw new ConsentManagementException(errorMsg); } - revokeTokens(retrievedDetailedConsentResource, userID); + + for (String user : consentUserIDSet) { + revokeTokens(retrievedDetailedConsentResource, user); + } } ArrayList consentMappingResources = retrievedDetailedConsentResource diff --git a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Footer.jsx b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Footer.jsx index f3e87c22..9c523d88 100644 --- a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Footer.jsx +++ b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Footer.jsx @@ -28,7 +28,6 @@ export const Footer = () => { return( - {common.complaintHandleLinkText} {common.footerContent} diff --git a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Nav.jsx b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Nav.jsx index e21f6432..dc08894c 100644 --- a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Nav.jsx +++ b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/common/Nav.jsx @@ -66,7 +66,10 @@ export const Nav = (user) => { className="navUserImage" rounded /> - {user.email} + { + (user.email && user.email.indexOf("@" + CONFIG.TENANT_DOMAIN) !== -1) ? + user.email.replace("@" + CONFIG.TENANT_DOMAIN, "") : user.email + } } > diff --git a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/detailedAgreementPage/KeyDatesInfo.jsx b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/detailedAgreementPage/KeyDatesInfo.jsx index 98fd48fb..00560345 100644 --- a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/detailedAgreementPage/KeyDatesInfo.jsx +++ b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/detailedAgreementPage/KeyDatesInfo.jsx @@ -44,15 +44,15 @@ export const KeyDatesInfo = ({consent, infoLabels, consentType}) => { timestamp = getLongTimestampInMillis(timestamp); return ( <> -
{keyDate.title}
-

{moment(timestamp).format(keyDate.dateFormat)}

+
{keyDate.title}
+
  • {(timestamp !== 0)? moment(timestamp).format(keyDate.dateFormat) : "N/A"}
  • ) } catch (e) { return ( <> -
    {keyDate.title}
    -

    +
    {keyDate.title}
    +
  • ) } @@ -68,16 +68,15 @@ export const KeyDatesInfo = ({consent, infoLabels, consentType}) => { return ( <> -
    {keyDate.title}
    -

    {moment(fromTime).format(keyDate.dateFormat)} - - {moment(toTime).format(keyDate.dateFormat)}

    +
    {keyDate.title}
    +
  • {moment(fromTime).format(keyDate.dateFormat)} - {(toTime !== 0)?moment(toTime).format(keyDate.dateFormat):"N/A"}
  • ) } catch (e) { return ( <> -
    {keyDate.title}
    -

    +
    {keyDate.title}
    +
  • ) } @@ -90,27 +89,34 @@ export const KeyDatesInfo = ({consent, infoLabels, consentType}) => { valueFromConsent = "N/A"; } else if (valueParameterKey === "receipt.Data.Initiation.InstructedAmount") { valueFromConsent = `${valueFromConsent.Amount} ${valueFromConsent.Currency}`; + } else if (valueParameterKey === "consentAttributes.sharing_duration_value") { + const intValue = parseInt(valueFromConsent, 10); + if (intValue >= 0 && intValue <= 86400) { + valueFromConsent = "OnceOff"; + } else { + valueFromConsent = "Ongoing"; + } } return ( <> -
    {keyDate.title}
    -

    {valueFromConsent}

    +
    {keyDate.title}
    +
  • {valueFromConsent}
  • ) } catch (e) { return ( <> -
    {keyDate.title}
    -

    +
    {keyDate.title}
    +
  • ) } } else { return ( <> -
    {keyDate.title}
    -

    {keyDate.text}

    +
    {keyDate.title}
    +
  • {keyDate.text}
  • ) } diff --git a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/errorPage/ResponseError.jsx b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/errorPage/ResponseError.jsx index 312358ab..f08f866d 100644 --- a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/errorPage/ResponseError.jsx +++ b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/errorPage/ResponseError.jsx @@ -17,7 +17,7 @@ */ import React from "react"; -import base64url from "base64url"; +import {decode as base64_decode } from 'base-64'; import wso2Logo from "../images/wso2Logo.png"; export const ResponseError = (error = {}) => { @@ -32,8 +32,8 @@ export const ResponseError = (error = {}) => { description = url.searchParams.get("description"); if (message && description) { - message = base64url.decode(message); - description = base64url.decode(description); + message = base64_decode(message); + description = base64_decode(description); } else { message = "Redirecting Failed!"; description = diff --git a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/landing_page/AdvanceSearch.jsx b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/landing_page/AdvanceSearch.jsx index 09a8775f..6ef7700b 100644 --- a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/landing_page/AdvanceSearch.jsx +++ b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/landing_page/AdvanceSearch.jsx @@ -222,13 +222,18 @@ export const AdvanceSearch = () => { className="sBorder" title="submit search" onClick={() => { + let userId = searchUser; + let userIdList = [userId]; + if (userId.length > 0 && userId.indexOf(CONFIG.TENANT_DOMAIN) === -1) { + userIdList.push(userId + "@" + CONFIG.TENANT_DOMAIN); + } let search = { ...searchObj, limit: searchLimit, offset: 0, dateRange: dateRange, consentIDs: consentId, - userIDs: searchUser, + userIDs: userIdList, clientIDs: softwareId, } setContextSearchObject(search) diff --git a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/specConfigs/common.js b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/specConfigs/common.js index 9d5b9f94..2cd699a5 100644 --- a/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/specConfigs/common.js +++ b/react-apps/self-care-portal/self-care-portal-frontend/accelerator/src/specConfigs/common.js @@ -17,8 +17,7 @@ */ export const common = { - footerContent: "WSO2 Open Banking | " + new Date().getFullYear(), - complaintHandleLinkText: "Complaint handling and resolution", + footerContent: "WSO2 Open Banking | " + new Date().getFullYear() }; export const keyDateTypes = { diff --git a/react-apps/self-care-portal/self-care-portal-frontend/package.json b/react-apps/self-care-portal/self-care-portal-frontend/package.json index 84b8f072..e21228e4 100644 --- a/react-apps/self-care-portal/self-care-portal-frontend/package.json +++ b/react-apps/self-care-portal/self-care-portal-frontend/package.json @@ -12,7 +12,7 @@ "@testing-library/user-event": "^7.2.1", "archiver": "^5.3.1", "axios": "^0.27.2", - "base64url": "^3.0.1", + "base-64": "^1.0.0", "bootstrap": "^4.5.3", "date-fns": "^2.17.0", "html2canvas": "^1.0.0-rc.7", @@ -70,5 +70,9 @@ "moduleNameMapper": { "overrideConfig": "/public/overrides/overrideConfig.js" } + }, + "engines": { + "node": ">=18.16.0", + "npm": ">=9.7.0" } } diff --git a/react-apps/self-care-portal/src/main/java/com/wso2/openbanking/scp/webapp/servlet/OAuthCallbackServlet.java b/react-apps/self-care-portal/src/main/java/com/wso2/openbanking/scp/webapp/servlet/OAuthCallbackServlet.java index 0c5e113f..97af6c52 100644 --- a/react-apps/self-care-portal/src/main/java/com/wso2/openbanking/scp/webapp/servlet/OAuthCallbackServlet.java +++ b/react-apps/self-care-portal/src/main/java/com/wso2/openbanking/scp/webapp/servlet/OAuthCallbackServlet.java @@ -45,6 +45,8 @@ public class OAuthCallbackServlet extends HttpServlet { private static final long serialVersionUID = -1253188744670051774L; private static final Log LOG = LogFactory.getLog(OAuthCallbackServlet.class); private static final String CODE = "code"; + private static final String ERROR = "error"; + private static final String ERROR_DESCRIPTION = "error_description"; @Generated(message = "Ignoring since all cases are covered from other unit tests") @Override @@ -69,6 +71,14 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) { // add cookies to response oAuthService.generateCookiesFromTokens(tokenResponse, req, resp); } + if ("access_denied".equals(req.getParameter(ERROR))) { + LOG.debug("User denied the consent. Error: " + req.getParameter(ERROR) + + "Error Description:" + req.getParameter(ERROR_DESCRIPTION)); + SCPError error = new SCPError(req.getParameter(ERROR), req.getParameter(ERROR_DESCRIPTION)); + final String errorUrlFormat = iamBaseUrl + "/consentmgr/error?message=%s&description=%s"; + Utils.sendErrorToFrontend(error, errorUrlFormat, resp); + return; + } LOG.debug("Redirecting to frontend application: " + redirectUrl); resp.sendRedirect(redirectUrl); } catch (TokenGenerationException | IOException e) {