Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Accelerator 4] Changing regulatory property to Fapi complaint to match IS property #259

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static String reduceStringLength(String input, int maxLength) {
* @throws RequestObjectException If an error occurs while checking the client ID
*/
@Generated(message = "Excluding from code coverage since it requires a service call")
public static boolean isRegulatoryApp(String clientId) throws RequestObjectException {
public static boolean isFapiConformantApp(String clientId) throws RequestObjectException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we update the method comment as well?


try {
return OAuth2Util.isFapiConformantApp(clientId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,6 @@ protected String getAllowedScopes(OAuth2Parameters oAuth2Parameters) throws Requ
@Generated(message = "Excluding from code coverage since it requires a service call")
protected boolean isRegulatory(OAuth2Parameters oAuth2Parameters) throws RequestObjectException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we update this method identifier?


return FinancialServicesUtils.isRegulatoryApp(oAuth2Parameters.getClientId());
return FinancialServicesUtils.isFapiConformantApp(oAuth2Parameters.getClientId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ OAuth2AuthorizeRespDTO issueCode(
@Generated(message = "Ignoring because it requires a service call")
boolean isRegulatory(String clientId) throws RequestObjectException {

return FinancialServicesUtils.isRegulatoryApp(clientId);
return FinancialServicesUtils.isFapiConformantApp(clientId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ OAuth2AuthorizeRespDTO issueCode(
@Generated(message = "Ignoring because it requires a service call")
boolean isRegulatory(String clientId) throws RequestObjectException {

return FinancialServicesUtils.isRegulatoryApp(clientId);
return FinancialServicesUtils.isFapiConformantApp(clientId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void validateRequiredParameters(HttpServletRequest request) throws OAuthP
private boolean isValidResponseType(String clientId, String responseType) {

try {
if (FinancialServicesUtils.isRegulatoryApp(clientId) && CODE.equals(responseType)) {
if (FinancialServicesUtils.isFapiConformantApp(clientId) && CODE.equals(responseType)) {
return false;
}
} catch (RequestObjectException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public JWTClaimsSet handleCustomClaims(JWTClaimsSet.Builder jwtClaimsSetBuilder,
/* accessToken property check is done to omit the following claims getting bound to id_token
The access token property is added to the ID token message context before this method is invoked. */
try {
if (FinancialServicesUtils.isRegulatoryApp(tokenReqMessageContext.getOauth2AccessTokenReqDTO()
if (FinancialServicesUtils.isFapiConformantApp(tokenReqMessageContext.getOauth2AccessTokenReqDTO()
.getClientId())
&& (tokenReqMessageContext.getProperty(IdentityCommonConstants.ACCESS_TOKEN) == null)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class FSAuthorizationCodeGrantHandler extends AuthorizationCodeGrantHandl
public OAuth2AccessTokenRespDTO issue(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception {

try {
if (FinancialServicesUtils.isRegulatoryApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
if (FinancialServicesUtils.isFapiConformantApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
OAuth2AccessTokenRespDTO oAuth2AccessTokenRespDTO = super.issue(tokReqMsgCtx);
executeInitialStep(oAuth2AccessTokenRespDTO, tokReqMsgCtx);
tokReqMsgCtx.setScope(IdentityCommonUtils.removeInternalScopes(tokReqMsgCtx.getScope()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class FSClientCredentialsGrantHandler extends ClientCredentialsGrantHandl
public OAuth2AccessTokenRespDTO issue(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception {

try {
if (FinancialServicesUtils.isRegulatoryApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
if (FinancialServicesUtils.isFapiConformantApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
OAuth2AccessTokenRespDTO oAuth2AccessTokenRespDTO = super.issue(tokReqMsgCtx);
executeInitialStep(oAuth2AccessTokenRespDTO, tokReqMsgCtx);
tokReqMsgCtx.setScope(IdentityCommonUtils.removeInternalScopes(tokReqMsgCtx.getScope()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class FSPasswordGrantHandler extends PasswordGrantHandler {
public OAuth2AccessTokenRespDTO issue(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception {

try {
if (FinancialServicesUtils.isRegulatoryApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
if (FinancialServicesUtils.isFapiConformantApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
OAuth2AccessTokenRespDTO oAuth2AccessTokenRespDTO = super.issue(tokReqMsgCtx);
executeInitialStep(oAuth2AccessTokenRespDTO, tokReqMsgCtx);
tokReqMsgCtx.setScope(IdentityCommonUtils.removeInternalScopes(tokReqMsgCtx.getScope()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class FSRefreshGrantHandler extends RefreshGrantHandler {
public OAuth2AccessTokenRespDTO issue(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception {

try {
if (FinancialServicesUtils.isRegulatoryApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
if (FinancialServicesUtils.isFapiConformantApp(tokReqMsgCtx.getOauth2AccessTokenReqDTO().getClientId())) {
OAuth2AccessTokenRespDTO oAuth2AccessTokenRespDTO = super.issue(tokReqMsgCtx);
executeInitialStep(oAuth2AccessTokenRespDTO, tokReqMsgCtx);
tokReqMsgCtx.setScope(IdentityCommonUtils.removeInternalScopes(tokReqMsgCtx.getScope()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void checkValidCodeResponseTypeValidation() throws OAuthProblemException
when(httpServletRequestMock.getParameter("response_type")).thenReturn("code");
when(httpServletRequestMock.getParameter("client_id")).thenReturn("1234567654321");

mock.when(() -> FinancialServicesUtils.isRegulatoryApp(anyString())).thenReturn(false);
mock.when(() -> FinancialServicesUtils.isFapiConformantApp(anyString())).thenReturn(false);

FSCodeResponseTypeValidator uut = spy(new FSCodeResponseTypeValidator());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void testHandleCustomClaims() throws IdentityOAuth2Exception {
identityCommonUtilsMock.when(IdentityCommonUtils::getMTLSAuthHeader)
.thenReturn(TestConstants.CERTIFICATE_HEADER);

fsUtilMock.when(() -> FinancialServicesUtils.isRegulatoryApp(anyString())).thenReturn(true);
fsUtilMock.when(() -> FinancialServicesUtils.isFapiConformantApp(anyString())).thenReturn(true);
frameworkUtilsMock.when(FrameworkUtils::getMultiAttributeSeparator)
.thenReturn(MULTI_ATTRIBUTE_SEPARATOR_DEFAULT);
Base64URL base64URL = Base64URL.encode(TestConstants.CERTIFICATE_CONTENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public Response retrieve(@Context HttpServletRequest request, @Context HttpServl
consentData.setState(state);

try {
consentData.setRegulatory(FinancialServicesUtils.isRegulatoryApp(clientId));
consentData.setRegulatory(FinancialServicesUtils.isFapiConformantApp(clientId));
} catch (RequestObjectException e) {
log.error("Error while getting regulatory data", e);
throw new ConsentException(redirectURI, AuthErrorCode.SERVER_ERROR,
Expand Down
Loading