Skip to content

Commit

Permalink
Merge branch 'master' into add-API-support-create-user-def-auth-local
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla authored Dec 1, 2024
2 parents a4a2fb8 + 825d0a4 commit b959007
Show file tree
Hide file tree
Showing 112 changed files with 260 additions and 401 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.expired.password.identification</artifactId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.expired.password.identification</artifactId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.idle.account.identification</artifactId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.idle.account.identification</artifactId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.action.management</artifactId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.action.management</artifactId>
<version>1.2.249-SNAPSHOT</version>
<version>1.2.258-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.wso2.carbon.identity.api.server.action.management.v1.ActionResponse;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionTypesResponseItem;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionUpdateModel;
import org.wso2.carbon.identity.api.server.action.management.v1.AuthenticationTypeProperties;
import org.wso2.carbon.identity.api.server.action.management.v1.Error;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionsApiService;

Expand Down Expand Up @@ -230,7 +229,7 @@ public Response getActionsByActionType(@ApiParam(value = "Name of the Action Typ
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Actions", })
}, tags={ "Actions" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ActionResponse.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
Expand All @@ -244,28 +243,4 @@ public Response updateAction(@ApiParam(value = "Name of the Action Type.",requir
return delegate.updateAction(actionType, actionId, actionUpdateModel );
}

@Valid
@PUT
@Path("/{actionType}/{actionId}/{authType}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Update Action endpoint authentication information by given Id. ", notes = "This API provides the capability to update Action endpoint authentication information by given Id. <br> <b>Scope required:</b> <br> * internal_action_mgt_update ", response = ActionResponse.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Actions" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ActionResponse.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@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) {

return delegate.updateActionEndpointAuthentication(actionType, actionId, authType, authenticationTypeProperties );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.wso2.carbon.identity.api.server.action.management.v1.ActionResponse;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionTypesResponseItem;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionUpdateModel;
import org.wso2.carbon.identity.api.server.action.management.v1.AuthenticationTypeProperties;
import org.wso2.carbon.identity.api.server.action.management.v1.Error;
import javax.ws.rs.core.Response;

Expand All @@ -51,6 +50,4 @@ public interface ActionsApiService {
public Response getActionsByActionType(String actionType);

public Response updateAction(String actionType, String actionId, ActionUpdateModel actionUpdateModel);

public Response updateActionEndpointAuthentication(String actionType, String actionId, String authType, AuthenticationTypeProperties authenticationTypeProperties);
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ public enum ErrorMessage {
ERROR_INVALID_ACTION_ENDPOINT_AUTHENTICATION_PROPERTIES("60010",
"Unable to perform the operation.",
"Required authentication properties are not provided or invalid."),
ERROR_INVALID_ACTION_ENDPOINT_AUTH_TYPE("60011",
"Invalid Authentication Type for Action Endpoint.",
"Invalid authentication type used for path parameter."),
ERROR_EMPTY_ACTION_ENDPOINT_AUTHENTICATION_PROPERTIES("60012",
ERROR_EMPTY_ACTION_ENDPOINT_AUTHENTICATION_PROPERTIES("60011",
"Unable to perform the operation.",
"Authentication property values cannot be empty."),
ERROR_NO_ACTION_FOUND_ON_GIVEN_ACTION_TYPE_AND_ID("60013",
ERROR_NO_ACTION_FOUND_ON_GIVEN_ACTION_TYPE_AND_ID("60012",
"Action is not found.",
"No action is found for given action id and action type"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.wso2.carbon.identity.api.server.action.management.v1.ActionType;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionTypesResponseItem;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionUpdateModel;
import org.wso2.carbon.identity.api.server.action.management.v1.AuthenticationTypeProperties;
import org.wso2.carbon.identity.api.server.action.management.v1.AuthenticationTypeResponse;
import org.wso2.carbon.identity.api.server.action.management.v1.EndpointResponse;
import org.wso2.carbon.identity.api.server.action.management.v1.util.ActionMgtEndpointUtil;
Expand All @@ -49,7 +48,6 @@

import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_EMPTY_ACTION_ENDPOINT_AUTHENTICATION_PROPERTIES;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_INVALID_ACTION_ENDPOINT_AUTHENTICATION_PROPERTIES;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_INVALID_ACTION_ENDPOINT_AUTH_TYPE;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_INVALID_ACTION_TYPE;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_NOT_IMPLEMENTED_ACTION_TYPE;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_NO_ACTION_FOUND_ON_GIVEN_ACTION_TYPE_AND_ID;
Expand Down Expand Up @@ -194,21 +192,6 @@ public List<ActionTypesResponseItem> getActionTypes() {
}
}

public ActionResponse updateActionEndpointAuthentication(String actionType, String actionId, String authType,
AuthenticationTypeProperties authenticationTypeProperties) {

try {
validateActionType(actionType);
Authentication authentication = buildAuthentication(getAuthTypeFromPath(authType),
authenticationTypeProperties.getProperties());
return buildActionResponse(ActionManagementServiceHolder.getActionManagementService()
.updateActionEndpointAuthentication(actionType, actionId, authentication,
CarbonContext.getThreadLocalCarbonContext().getTenantDomain()));
} catch (ActionMgtException e) {
throw ActionMgtEndpointUtil.handleActionMgtException(e);
}
}

/**
* Build ActionResponse from Action.
*
Expand Down Expand Up @@ -361,21 +344,6 @@ private Authentication buildAuthentication(Authentication.Type authType, Map<Str
}
}

/**
* Get Authentication Type from path.
*
* @param authType Authentication Type.
* @return Auth Type resolved from the path param.
*/
private Authentication.Type getAuthTypeFromPath(String authType) {

return Arrays.stream(Authentication.Type.values())
.filter(type -> type.getPathParam().equals(authType))
.findFirst()
.orElseThrow(() -> ActionMgtEndpointUtil.handleException(Response.Status.BAD_REQUEST,
ERROR_INVALID_ACTION_ENDPOINT_AUTH_TYPE));
}

private void validateActionType(String actionType) {

Action.ActionTypes actionTypeEnum =
Expand Down
Loading

0 comments on commit b959007

Please sign in to comment.