Search in sources :

Example 1 with AllEntitlementsResponseModel

use of org.wso2.carbon.identity.entitlement.endpoint.resources.models.AllEntitlementsResponseModel in project carbon-identity-framework by wso2.

the class DecisionResource method getAllEntitlements.

/**
 * API endpoint for returning all entitlements for a given set of parameters
 *
 * @return AllEntitlementResponseModel object
 */
@POST
@Path("entitlements-all")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get all entitlements for a given set of parameters", response = AllEntitlementsResponseModel.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "All Entitlements response", response = AllEntitlementsResponseModel.class), @ApiResponse(code = 40010, message = EntitlementEndpointConstants.ERROR_UNAUTHORIZED_MESSAGE, response = ExceptionBean.class), @ApiResponse(code = 40020, message = EntitlementEndpointConstants.ERROR_REQUEST_PARSE_MESSAGE, response = ExceptionBean.class), @ApiResponse(code = 40010, message = EntitlementEndpointConstants.ERROR_RESPONSE_READ_MESSAGE, response = ExceptionBean.class) })
public AllEntitlementsResponseModel getAllEntitlements(@ApiParam(value = "Request Media Type", required = true) @HeaderParam(EntitlementEndpointConstants.ACCEPT_HEADER) String format, @ApiParam(value = "Authentication Type", required = true) @HeaderParam(EntitlementEndpointConstants.AUTHENTICATION_TYPE_HEADER) String authMechanism, @ApiParam(value = "Add HTTP Basic Authorization", required = true) @HeaderParam(EntitlementEndpointConstants.AUTHORIZATION_HEADER) String authorization, @ApiParam(value = "Response Media Type", required = true) @HeaderParam(EntitlementEndpointConstants.CONTENT_TYPE_HEADER) String contentType, @ApiParam(value = "All Entitlements Model", required = true) AllEntitlementsRequestModel request) {
    PolicySearch policySearch = EntitlementEngine.getInstance().getPolicySearch();
    EntitledResultSetDTO resultSet = policySearch.getEntitledAttributes(request.getIdentifier(), request.getGivenAttributes());
    AllEntitlementsResponseModel response = new AllEntitlementsResponseModel();
    response.setEntitledResultSetDTO(resultSet);
    return response;
}
Also used : AllEntitlementsResponseModel(org.wso2.carbon.identity.entitlement.endpoint.resources.models.AllEntitlementsResponseModel) PolicySearch(org.wso2.carbon.identity.entitlement.policy.search.PolicySearch) EntitledResultSetDTO(org.wso2.carbon.identity.entitlement.dto.EntitledResultSetDTO) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 EntitledResultSetDTO (org.wso2.carbon.identity.entitlement.dto.EntitledResultSetDTO)1 AllEntitlementsResponseModel (org.wso2.carbon.identity.entitlement.endpoint.resources.models.AllEntitlementsResponseModel)1 PolicySearch (org.wso2.carbon.identity.entitlement.policy.search.PolicySearch)1