Skip to content

Commit

Permalink
Fix test failures (#13375)
Browse files Browse the repository at this point in the history
* fix test failures for,
- APISecurityTestCase.testInvocationWithRevokedApiKeys
- APISecurityTestCase.testInvokeJWTUserToken
- GrantTypeTokenGenerateTestCase.testTokenGenerationWithCorruptedClientCredentials
- FederatedUserJWTTestCase.testVerifyJWTClaimsInFederatedUserJWTAPP - the behavior has changed from IS 5.11 to 6.0. Related wso2/product-is#14447. After analyzing the related issue, this test need to be revisited to make sure product behavior is backward compatible.

* fix test failures for,
- APISecurityTestCase.testInvocationWithRevokedApiKeys
- APISecurityTestCase.testInvokeJWTUserToken
- GrantTypeTokenGenerateTestCase.testTokenGenerationWithCorruptedClientCredentials
- FederatedUserJWTTestCase.testVerifyJWTClaimsInFederatedUserJWTAPP - the behavior has changed from IS 5.11 to 6.0. Related wso2/product-is#14447. After analyzing the related issue, this test need to be revisited to make sure product behavior is backward compatible.

* remove commented.

* upgrade identity inbound version.
  • Loading branch information
dushaniw committed Feb 16, 2024
1 parent 01086c2 commit 1050e6b
Show file tree
Hide file tree
Showing 10 changed files with 565 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"oauth.grant_type.uma_ticket.grant_handler": "org.wso2.carbon.identity.oauth.uma.grant.UMA2GrantHandler",
"oauth.grant_type.uma_ticket.grant_validator": "org.wso2.carbon.identity.oauth.uma.grant.GrantValidator",
"oauth.revoked_token_headers_in_response.enable": true,
"oauth.token_persistence.enable": true,
"system.parameter.'org.wso2.CipherTransformation'": "RSA/ECB/OAEPwithSHA1andMGF1Padding",
"server.userAgent": "WSO2 AM 4.3.0",
"server.serverDetails": "WSO2 AM 4.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


import org.wso2.am.integration.clients.internal.api.dto.ErrorDTO;
import org.wso2.am.integration.clients.internal.api.dto.RevokedJWTListDTO;
import org.wso2.am.integration.clients.internal.api.dto.RevokedEventsDTO;

import java.lang.reflect.Type;
import java.util.ArrayList;
Expand Down Expand Up @@ -115,23 +115,23 @@ private com.squareup.okhttp.Call revokedjwtGetValidateBeforeCall(final ProgressR
/**
* JTIs of revoked jwt tokens
* This will provide access to JTIs of revoked JWT tokens in database.
* @return RevokedJWTListDTO
* @return RevokedEventsDTO
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public RevokedJWTListDTO revokedjwtGet() throws ApiException {
ApiResponse<RevokedJWTListDTO> resp = revokedjwtGetWithHttpInfo();
public RevokedEventsDTO revokedjwtGet() throws ApiException {
ApiResponse<RevokedEventsDTO> resp = revokedjwtGetWithHttpInfo();
return resp.getData();
}

/**
* JTIs of revoked jwt tokens
* This will provide access to JTIs of revoked JWT tokens in database.
* @return ApiResponse&lt;RevokedJWTListDTO&gt;
* @return ApiResponse&lt;RevokedEventsDTO&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<RevokedJWTListDTO> revokedjwtGetWithHttpInfo() throws ApiException {
public ApiResponse<RevokedEventsDTO> revokedjwtGetWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = revokedjwtGetValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken<RevokedJWTListDTO>(){}.getType();
Type localVarReturnType = new TypeToken<RevokedEventsDTO>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}

Expand All @@ -142,7 +142,7 @@ public ApiResponse<RevokedJWTListDTO> revokedjwtGetWithHttpInfo() throws ApiExce
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call revokedjwtGetAsync(final ApiCallback<RevokedJWTListDTO> callback) throws ApiException {
public com.squareup.okhttp.Call revokedjwtGetAsync(final ApiCallback<RevokedEventsDTO> callback) throws ApiException {

ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
Expand All @@ -164,7 +164,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
}

com.squareup.okhttp.Call call = revokedjwtGetValidateBeforeCall(progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<RevokedJWTListDTO>(){}.getType();
Type localVarReturnType = new TypeToken<RevokedEventsDTO>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/*
* Internal Utility API
* This API allows you to access internal data.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/


package org.wso2.am.integration.clients.internal.api.dto;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.wso2.am.integration.clients.internal.api.dto.RevokedJWTConsumerKeyDTO;
import org.wso2.am.integration.clients.internal.api.dto.RevokedJWTDTO;
import org.wso2.am.integration.clients.internal.api.dto.RevokedJWTSubjectEntityDTO;

/**
* RevokedEventsDTO
*/

public class RevokedEventsDTO {
@SerializedName("revokedJWTList")
private List<RevokedJWTDTO> revokedJWTList = null;

@SerializedName("revokedJWTSubjectEntityList")
private List<RevokedJWTSubjectEntityDTO> revokedJWTSubjectEntityList = null;

@SerializedName("revokedJWTConsumerKeyList")
private List<RevokedJWTConsumerKeyDTO> revokedJWTConsumerKeyList = null;

public RevokedEventsDTO revokedJWTList(List<RevokedJWTDTO> revokedJWTList) {
this.revokedJWTList = revokedJWTList;
return this;
}

public RevokedEventsDTO addRevokedJWTListItem(RevokedJWTDTO revokedJWTListItem) {
if (this.revokedJWTList == null) {
this.revokedJWTList = new ArrayList<>();
}
this.revokedJWTList.add(revokedJWTListItem);
return this;
}

/**
* Get revokedJWTList
* @return revokedJWTList
**/
@ApiModelProperty(value = "")
public List<RevokedJWTDTO> getRevokedJWTList() {
return revokedJWTList;
}

public void setRevokedJWTList(List<RevokedJWTDTO> revokedJWTList) {
this.revokedJWTList = revokedJWTList;
}

public RevokedEventsDTO revokedJWTSubjectEntityList(List<RevokedJWTSubjectEntityDTO> revokedJWTSubjectEntityList) {
this.revokedJWTSubjectEntityList = revokedJWTSubjectEntityList;
return this;
}

public RevokedEventsDTO addRevokedJWTSubjectEntityListItem(RevokedJWTSubjectEntityDTO revokedJWTSubjectEntityListItem) {
if (this.revokedJWTSubjectEntityList == null) {
this.revokedJWTSubjectEntityList = new ArrayList<>();
}
this.revokedJWTSubjectEntityList.add(revokedJWTSubjectEntityListItem);
return this;
}

/**
* Get revokedJWTSubjectEntityList
* @return revokedJWTSubjectEntityList
**/
@ApiModelProperty(value = "")
public List<RevokedJWTSubjectEntityDTO> getRevokedJWTSubjectEntityList() {
return revokedJWTSubjectEntityList;
}

public void setRevokedJWTSubjectEntityList(List<RevokedJWTSubjectEntityDTO> revokedJWTSubjectEntityList) {
this.revokedJWTSubjectEntityList = revokedJWTSubjectEntityList;
}

public RevokedEventsDTO revokedJWTConsumerKeyList(List<RevokedJWTConsumerKeyDTO> revokedJWTConsumerKeyList) {
this.revokedJWTConsumerKeyList = revokedJWTConsumerKeyList;
return this;
}

public RevokedEventsDTO addRevokedJWTConsumerKeyListItem(RevokedJWTConsumerKeyDTO revokedJWTConsumerKeyListItem) {
if (this.revokedJWTConsumerKeyList == null) {
this.revokedJWTConsumerKeyList = new ArrayList<>();
}
this.revokedJWTConsumerKeyList.add(revokedJWTConsumerKeyListItem);
return this;
}

/**
* Get revokedJWTConsumerKeyList
* @return revokedJWTConsumerKeyList
**/
@ApiModelProperty(value = "")
public List<RevokedJWTConsumerKeyDTO> getRevokedJWTConsumerKeyList() {
return revokedJWTConsumerKeyList;
}

public void setRevokedJWTConsumerKeyList(List<RevokedJWTConsumerKeyDTO> revokedJWTConsumerKeyList) {
this.revokedJWTConsumerKeyList = revokedJWTConsumerKeyList;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RevokedEventsDTO revokedEvents = (RevokedEventsDTO) o;
return Objects.equals(this.revokedJWTList, revokedEvents.revokedJWTList) &&
Objects.equals(this.revokedJWTSubjectEntityList, revokedEvents.revokedJWTSubjectEntityList) &&
Objects.equals(this.revokedJWTConsumerKeyList, revokedEvents.revokedJWTConsumerKeyList);
}

@Override
public int hashCode() {
return Objects.hash(revokedJWTList, revokedJWTSubjectEntityList, revokedJWTConsumerKeyList);
}


@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RevokedEventsDTO {\n");

sb.append(" revokedJWTList: ").append(toIndentedString(revokedJWTList)).append("\n");
sb.append(" revokedJWTSubjectEntityList: ").append(toIndentedString(revokedJWTSubjectEntityList)).append("\n");
sb.append(" revokedJWTConsumerKeyList: ").append(toIndentedString(revokedJWTConsumerKeyList)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/*
* Internal Utility API
* This API allows you to access internal data.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/


package org.wso2.am.integration.clients.internal.api.dto;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

/**
* RevokedJWTConsumerKeyDTO
*/

public class RevokedJWTConsumerKeyDTO {
@SerializedName("consumer_key")
private String consumerKey = null;

@SerializedName("revocation_time")
private Long revocationTime = null;

@SerializedName("type")
private String type = null;

@SerializedName("organization")
private String organization = null;

public RevokedJWTConsumerKeyDTO consumerKey(String consumerKey) {
this.consumerKey = consumerKey;
return this;
}

/**
* consumer key of the JWT.
* @return consumerKey
**/
@ApiModelProperty(value = "consumer key of the JWT.")
public String getConsumerKey() {
return consumerKey;
}

public void setConsumerKey(String consumerKey) {
this.consumerKey = consumerKey;
}

public RevokedJWTConsumerKeyDTO revocationTime(Long revocationTime) {
this.revocationTime = revocationTime;
return this;
}

/**
* revocation timestamp.
* @return revocationTime
**/
@ApiModelProperty(value = "revocation timestamp.")
public Long getRevocationTime() {
return revocationTime;
}

public void setRevocationTime(Long revocationTime) {
this.revocationTime = revocationTime;
}

public RevokedJWTConsumerKeyDTO type(String type) {
this.type = type;
return this;
}

/**
* revoked consumer key type.
* @return type
**/
@ApiModelProperty(value = "revoked consumer key type.")
public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public RevokedJWTConsumerKeyDTO organization(String organization) {
this.organization = organization;
return this;
}

/**
* organization of the revoked consumer key
* @return organization
**/
@ApiModelProperty(value = "organization of the revoked consumer key")
public String getOrganization() {
return organization;
}

public void setOrganization(String organization) {
this.organization = organization;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RevokedJWTConsumerKeyDTO revokedJWTConsumerKey = (RevokedJWTConsumerKeyDTO) o;
return Objects.equals(this.consumerKey, revokedJWTConsumerKey.consumerKey) &&
Objects.equals(this.revocationTime, revokedJWTConsumerKey.revocationTime) &&
Objects.equals(this.type, revokedJWTConsumerKey.type) &&
Objects.equals(this.organization, revokedJWTConsumerKey.organization);
}

@Override
public int hashCode() {
return Objects.hash(consumerKey, revocationTime, type, organization);
}


@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RevokedJWTConsumerKeyDTO {\n");

sb.append(" consumerKey: ").append(toIndentedString(consumerKey)).append("\n");
sb.append(" revocationTime: ").append(toIndentedString(revocationTime)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" organization: ").append(toIndentedString(organization)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}

Loading

0 comments on commit 1050e6b

Please sign in to comment.