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

Improve PATCH endpoint to update the full Action in action-management #635

Merged
merged 4 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -38,7 +38,7 @@ public class ActionBasicResponse {
@XmlEnum(String.class)
public enum TypeEnum {

@XmlEnumValue("PRE_ISSUE_ACCESS_TOKEN") PRE_ISSUE_ACCESS_TOKEN(String.valueOf("PRE_ISSUE_ACCESS_TOKEN")), @XmlEnumValue("PRE_UPDATE_PASSWORD") PRE_UPDATE_PASSWORD(String.valueOf("PRE_UPDATE_PASSWORD")), @XmlEnumValue("PRE_UPDATE_PROFILE") PRE_UPDATE_PROFILE(String.valueOf("PRE_UPDATE_PROFILE")), @XmlEnumValue("PRE_REGISTRATION") PRE_REGISTRATION(String.valueOf("PRE_REGISTRATION")), @XmlEnumValue("POST_LOGIN") POST_LOGIN(String.valueOf("POST_LOGIN")), @XmlEnumValue("PRE_LOGIN") PRE_LOGIN(String.valueOf("PRE_LOGIN"));
@XmlEnumValue("PRE_ISSUE_ACCESS_TOKEN") PRE_ISSUE_ACCESS_TOKEN(String.valueOf("PRE_ISSUE_ACCESS_TOKEN")), @XmlEnumValue("PRE_UPDATE_PASSWORD") PRE_UPDATE_PASSWORD(String.valueOf("PRE_UPDATE_PASSWORD")), @XmlEnumValue("PRE_UPDATE_PROFILE") PRE_UPDATE_PROFILE(String.valueOf("PRE_UPDATE_PROFILE")), @XmlEnumValue("PRE_REGISTRATION") PRE_REGISTRATION(String.valueOf("PRE_REGISTRATION"));


private String value;
Expand Down Expand Up @@ -150,7 +150,7 @@ public ActionBasicResponse name(String name) {

@ApiModelProperty(example = "Access Token Pre Issue", value = "")
@JsonProperty("name")
@Valid
@Valid @Size(min=1,max=255)
public String getName() {
return name;
}
Expand All @@ -168,7 +168,7 @@ public ActionBasicResponse description(String description) {

@ApiModelProperty(example = "This is the configuration of pre-action for issuing access token.", value = "")
@JsonProperty("description")
@Valid
@Valid @Size(max=255)
public String getDescription() {
return description;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ActionModel name(String name) {
@JsonProperty("name")
@Valid
@NotNull(message = "Property name cannot be null.")

@Size(min=1,max=255)
public String getName() {
return name;
}
Expand All @@ -67,7 +67,7 @@ public ActionModel description(String description) {

@ApiModelProperty(example = "This is the configuration of pre-action for issuing access token.", value = "")
@JsonProperty("description")
@Valid
@Valid @Size(max=255)
public String getDescription() {
return description;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ActionResponse {
@XmlEnum(String.class)
public enum TypeEnum {

@XmlEnumValue("PRE_ISSUE_ACCESS_TOKEN") PRE_ISSUE_ACCESS_TOKEN(String.valueOf("PRE_ISSUE_ACCESS_TOKEN")), @XmlEnumValue("PRE_UPDATE_PASSWORD") PRE_UPDATE_PASSWORD(String.valueOf("PRE_UPDATE_PASSWORD")), @XmlEnumValue("PRE_UPDATE_PROFILE") PRE_UPDATE_PROFILE(String.valueOf("PRE_UPDATE_PROFILE")), @XmlEnumValue("PRE_REGISTRATION") PRE_REGISTRATION(String.valueOf("PRE_REGISTRATION")), @XmlEnumValue("POST_LOGIN") POST_LOGIN(String.valueOf("POST_LOGIN")), @XmlEnumValue("PRE_LOGIN") PRE_LOGIN(String.valueOf("PRE_LOGIN"));
@XmlEnumValue("PRE_ISSUE_ACCESS_TOKEN") PRE_ISSUE_ACCESS_TOKEN(String.valueOf("PRE_ISSUE_ACCESS_TOKEN")), @XmlEnumValue("PRE_UPDATE_PASSWORD") PRE_UPDATE_PASSWORD(String.valueOf("PRE_UPDATE_PASSWORD")), @XmlEnumValue("PRE_UPDATE_PROFILE") PRE_UPDATE_PROFILE(String.valueOf("PRE_UPDATE_PROFILE")), @XmlEnumValue("PRE_REGISTRATION") PRE_REGISTRATION(String.valueOf("PRE_REGISTRATION"));


private String value;
Expand Down Expand Up @@ -152,7 +152,7 @@ public ActionResponse name(String name) {

@ApiModelProperty(example = "Access Token Pre Issue", value = "")
@JsonProperty("name")
@Valid
@Valid @Size(min=1,max=255)
public String getName() {
return name;
}
Expand All @@ -170,7 +170,7 @@ public ActionResponse description(String description) {

@ApiModelProperty(example = "This is the configuration of pre-action for issuing access token.", value = "")
@JsonProperty("description")
@Valid
@Valid @Size(max=255)
public String getDescription() {
return description;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ActionTypesResponseItem {
@XmlEnum(String.class)
public enum TypeEnum {

@XmlEnumValue("PRE_ISSUE_ACCESS_TOKEN") PRE_ISSUE_ACCESS_TOKEN(String.valueOf("PRE_ISSUE_ACCESS_TOKEN")), @XmlEnumValue("PRE_UPDATE_PASSWORD") PRE_UPDATE_PASSWORD(String.valueOf("PRE_UPDATE_PASSWORD")), @XmlEnumValue("PRE_UPDATE_PROFILE") PRE_UPDATE_PROFILE(String.valueOf("PRE_UPDATE_PROFILE")), @XmlEnumValue("PRE_REGISTRATION") PRE_REGISTRATION(String.valueOf("PRE_REGISTRATION")), @XmlEnumValue("POST_LOGIN") POST_LOGIN(String.valueOf("POST_LOGIN")), @XmlEnumValue("PRE_LOGIN") PRE_LOGIN(String.valueOf("PRE_LOGIN"));
@XmlEnumValue("PRE_ISSUE_ACCESS_TOKEN") PRE_ISSUE_ACCESS_TOKEN(String.valueOf("PRE_ISSUE_ACCESS_TOKEN")), @XmlEnumValue("PRE_UPDATE_PASSWORD") PRE_UPDATE_PASSWORD(String.valueOf("PRE_UPDATE_PASSWORD")), @XmlEnumValue("PRE_UPDATE_PROFILE") PRE_UPDATE_PROFILE(String.valueOf("PRE_UPDATE_PROFILE")), @XmlEnumValue("PRE_REGISTRATION") PRE_REGISTRATION(String.valueOf("PRE_REGISTRATION"));


private String value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.identity.api.server.action.management.v1.EndpointUpdateModel;
import javax.validation.constraints.*;


Expand All @@ -34,7 +35,7 @@ public class ActionUpdateModel {

private String name;
private String description;
private String endpointUri;
private EndpointUpdateModel endpoint;

/**
**/
Expand All @@ -46,7 +47,7 @@ public ActionUpdateModel name(String name) {

@ApiModelProperty(example = "Access Token Pre Issue", value = "")
@JsonProperty("name")
@Valid
@Valid @Size(min=1,max=255)
public String getName() {
return name;
}
Expand All @@ -64,7 +65,7 @@ public ActionUpdateModel description(String description) {

@ApiModelProperty(example = "This is the configuration of pre-action for issuing access token.", value = "")
@JsonProperty("description")
@Valid
@Valid @Size(max=255)
public String getDescription() {
return description;
}
Expand All @@ -74,20 +75,20 @@ public void setDescription(String description) {

/**
**/
public ActionUpdateModel endpointUri(String endpointUri) {
public ActionUpdateModel endpoint(EndpointUpdateModel endpoint) {

this.endpointUri = endpointUri;
this.endpoint = endpoint;
return this;
}

@ApiModelProperty(example = "https://abcd.com/token", value = "")
@JsonProperty("endpointUri")
@ApiModelProperty(value = "")
@JsonProperty("endpoint")
@Valid
public String getEndpointUri() {
return endpointUri;
public EndpointUpdateModel getEndpoint() {
return endpoint;
}
public void setEndpointUri(String endpointUri) {
this.endpointUri = endpointUri;
public void setEndpoint(EndpointUpdateModel endpoint) {
this.endpoint = endpoint;
}


Expand All @@ -104,12 +105,12 @@ public boolean equals(java.lang.Object o) {
ActionUpdateModel actionUpdateModel = (ActionUpdateModel) o;
return Objects.equals(this.name, actionUpdateModel.name) &&
Objects.equals(this.description, actionUpdateModel.description) &&
Objects.equals(this.endpointUri, actionUpdateModel.endpointUri);
Objects.equals(this.endpoint, actionUpdateModel.endpoint);
}

@Override
public int hashCode() {
return Objects.hash(name, description, endpointUri);
return Objects.hash(name, description, endpoint);
}

@Override
Expand All @@ -120,7 +121,7 @@ public String toString() {

sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" endpointUri: ").append(toIndentedString(endpointUri)).append("\n");
sb.append(" endpoint: ").append(toIndentedString(endpoint)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ActionsApi {
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response activateAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="PreIssueAccessToken, PreUpdatePassword, PreUpdateProfile, PreRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId) {
public Response activateAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="preIssueAccessToken, preUpdatePassword, preUpdateProfile, preRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId) {

return delegate.activateAction(actionType, actionId );
}
Expand All @@ -92,7 +92,7 @@ public Response activateAction(@ApiParam(value = "Name of the Action Type.",requ
@ApiResponse(code = 500, message = "Server Error", response = Error.class),
@ApiResponse(code = 501, message = "Not Implemented", response = Error.class)
})
public Response createAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="PreIssueAccessToken, PreUpdatePassword, PreUpdateProfile, PreRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "This represents the action to be created." ,required=true) @Valid ActionModel actionModel) {
public Response createAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="preIssueAccessToken, preUpdatePassword, preUpdateProfile, preRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "This represents the action to be created." ,required=true) @Valid ActionModel actionModel) {

return delegate.createAction(actionType, actionModel );
}
Expand All @@ -116,7 +116,7 @@ public Response createAction(@ApiParam(value = "Name of the Action Type.",requir
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response deactivateAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="PreIssueAccessToken, PreUpdatePassword, PreUpdateProfile, PreRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId) {
public Response deactivateAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="preIssueAccessToken, preUpdatePassword, preUpdateProfile, preRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId) {

return delegate.deactivateAction(actionType, actionId );
}
Expand All @@ -140,7 +140,7 @@ public Response deactivateAction(@ApiParam(value = "Name of the Action Type.",re
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response deleteAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="PreIssueAccessToken, PreUpdatePassword, PreUpdateProfile, PreRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId) {
public Response deleteAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="preIssueAccessToken, preUpdatePassword, preUpdateProfile, preRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId) {

return delegate.deleteAction(actionType, actionId );
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public Response getActionTypes() {
@ApiResponse(code = 500, message = "Server Error", response = Error.class),
@ApiResponse(code = 501, message = "Not Implemented", response = Error.class)
})
public Response getActionsByActionType(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="PreIssueAccessToken, PreUpdatePassword, PreUpdateProfile, PreRegistration") @PathParam("actionType") String actionType) {
public Response getActionsByActionType(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="preIssueAccessToken, preUpdatePassword, preUpdateProfile, preRegistration") @PathParam("actionType") String actionType) {

return delegate.getActionsByActionType(actionType );
}
Expand All @@ -214,7 +214,7 @@ public Response getActionsByActionType(@ApiParam(value = "Name of the Action Typ
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response updateAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="PreIssueAccessToken, PreUpdatePassword, PreUpdateProfile, PreRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId, @ApiParam(value = "This represents the action information to be updated." ,required=true) @Valid ActionUpdateModel actionUpdateModel) {
public Response updateAction(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="preIssueAccessToken, preUpdatePassword, preUpdateProfile, preRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId, @ApiParam(value = "This represents the action information to be updated." ,required=true) @Valid ActionUpdateModel actionUpdateModel) {

return delegate.updateAction(actionType, actionId, actionUpdateModel );
}
Expand All @@ -238,7 +238,7 @@ public Response updateAction(@ApiParam(value = "Name of the Action Type.",requir
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response updateActionEndpointAuthentication(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="PreIssueAccessToken, PreUpdatePassword, PreUpdateProfile, PreRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId, @ApiParam(value = "Authentication Type of the Action Endpoint.",required=true, allowableValues="none, basic, apiKey, bearer") @PathParam("authType") String authType, @ApiParam(value = "This represents the action endpoint authentication to be updated." ,required=true) @Valid AuthenticationTypeProperties authenticationTypeProperties) {
public Response updateActionEndpointAuthentication(@ApiParam(value = "Name of the Action Type.",required=true, allowableValues="preIssueAccessToken, preUpdatePassword, preUpdateProfile, preRegistration") @PathParam("actionType") String actionType, @ApiParam(value = "Id of the Action.",required=true) @PathParam("actionId") String actionId, @ApiParam(value = "Authentication Type of the Action Endpoint.",required=true, allowableValues="none, basic, apiKey, bearer") @PathParam("authType") String authType, @ApiParam(value = "This represents the action endpoint authentication to be updated." ,required=true) @Valid AuthenticationTypeProperties authenticationTypeProperties) {

return delegate.updateActionEndpointAuthentication(actionType, actionId, authType, authenticationTypeProperties );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static TypeEnum fromValue(String value) {
}

private TypeEnum type;
private Map<String, Object> properties = null;
private Map<String, Object> properties = new HashMap<String, Object>();


/**
Expand Down Expand Up @@ -100,9 +100,11 @@ public AuthenticationType properties(Map<String, Object> properties) {
return this;
}

@ApiModelProperty(example = "{\"username\":\"auth_username\",\"password\":\"auth_password\"}", value = "")
@ApiModelProperty(example = "{\"username\":\"auth_username\",\"password\":\"auth_password\"}", required = true, value = "")
@JsonProperty("properties")
@Valid
@NotNull(message = "Property properties cannot be null.")

public Map<String, Object> getProperties() {
return properties;
}
Expand All @@ -112,9 +114,6 @@ public void setProperties(Map<String, Object> properties) {


public AuthenticationType putPropertiesItem(String key, Object propertiesItem) {
if (this.properties == null) {
this.properties = new HashMap<String, Object>();
}
this.properties.put(key, propertiesItem);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public AuthenticationTypeProperties properties(Map<String, Object> properties) {
return this;
}

@ApiModelProperty(example = "{\"username\":\"auth_username\",\"password\":\"auth_username\"}", value = "")
@ApiModelProperty(example = "{\"username\":\"auth_username\",\"password\":\"auth_password\"}", value = "")
@JsonProperty("properties")
@Valid
public Map<String, Object> getProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Endpoint uri(String uri) {
@JsonProperty("uri")
@Valid
@NotNull(message = "Property uri cannot be null.")

@Pattern(regexp="^https?://.+")
public String getUri() {
return uri;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public EndpointResponse uri(String uri) {
@JsonProperty("uri")
@Valid
@NotNull(message = "Property uri cannot be null.")

@Pattern(regexp="^https?://.+")
public String getUri() {
return uri;
}
Expand Down
Loading
Loading