Skip to content

Commit

Permalink
Refactor constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Akila94 committed Nov 14, 2024
1 parent 53d9411 commit aac9531
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.wso2.carbon.identity.oauth2.util.OAuth2Util;
import org.wso2.openbanking.cds.identity.authenticator.util.CDSJWTValidator;
import org.wso2.openbanking.cds.identity.authenticator.util.Constants;
import org.wso2.openbanking.cds.identity.dcr.constants.CDSValidationConstants;
import org.wso2.openbanking.cds.identity.utils.CDSIdentityConstants;

import java.text.ParseException;
import java.util.ArrayList;
Expand Down Expand Up @@ -183,7 +183,7 @@ private CDSJWTValidator createJWTValidator(String accessedEndpoint, boolean prev

private List<String> populateMandatoryClaims() {

return CDSValidationConstants.MANDATORY_ASSERTION_PARAMS_LIST;
return CDSIdentityConstants.MANDATORY_ASSERTION_PARAMS_LIST;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*/
package org.wso2.openbanking.cds.identity.dcr.constants;

import org.wso2.carbon.identity.oauth2.token.handler.clientauth.jwt.Constants;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -56,6 +54,4 @@ public class CDSValidationConstants {
public static final String DCR_VALIDATE_SECTOR_IDENTIFIER_URI = "DCR.EnableSectorIdentifierUriValidation";
public static final String JTI = "jti";
public static final String JTI_REPLAYED = "JTI value of the registration request has been replayed";
public static final List<String> MANDATORY_ASSERTION_PARAMS_LIST = List.of(Constants.ISSUER_CLAIM,
Constants.SUBJECT_CLAIM, Constants.AUDIENCE_CLAIM, Constants.EXPIRATION_TIME_CLAIM, Constants.JWT_ID_CLAIM);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void validateAdditionalParams(Map<String, Object> parameters) throws Push
PushAuthRequestConstants.INVALID_REQUEST_OBJECT,
CDSIdentityConstants.INVALID_PUSH_AUTH_REQUEST);
}
for (String key : CDSValidationConstants.MANDATORY_ASSERTION_PARAMS_LIST) {
for (String key : CDSIdentityConstants.MANDATORY_ASSERTION_PARAMS_LIST) {
if (!assertionClaims.containsKey(key)) {
throw new PushAuthRequestValidatorException(HttpStatus.SC_BAD_REQUEST,
PushAuthRequestConstants.INVALID_REQUEST, "Mandatory field :" + key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

package org.wso2.openbanking.cds.identity.utils;

import org.wso2.openbanking.cds.identity.authenticator.util.Constants;

import java.util.List;

/**
* Identity Constants Class.
*/
Expand All @@ -42,5 +46,7 @@ public class CDSIdentityConstants {
public static final String JWT_RESPONSE_MODE = "jwt";
public static final String UNSUPPORTED_RESPONSE_TYPE_ERROR = "unsupported_response_type";
public static final String SESSION_DATA_KEY_PARAMETER = "sessionDataKey";
public static final List<String> MANDATORY_ASSERTION_PARAMS_LIST = List.of(Constants.ISSUER_CLAIM,
Constants.SUBJECT_CLAIM, Constants.AUDIENCE_CLAIM, Constants.EXPIRATION_TIME_CLAIM, Constants.JWT_ID_CLAIM);

}

0 comments on commit aac9531

Please sign in to comment.