Search in sources :

Example 1 with IdentityProviderResponse

use of org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderResponse in project identity-api-server by wso2.

the class ServerIdpManagementService method createIDPResponse.

private IdentityProviderResponse createIDPResponse(IdentityProvider identityProvider) {
    IdentityProviderResponse idpResponse = new IdentityProviderResponse();
    populateIDPBasicInfo(idpResponse, identityProvider);
    idpResponse.setTemplateId(identityProvider.getTemplateId());
    idpResponse.setCertificate(createIDPCertificate(identityProvider));
    idpResponse.setClaims(createClaimResponse(identityProvider.getClaimConfig()));
    idpResponse.setRoles(createRoleResponse(identityProvider));
    idpResponse.setFederatedAuthenticators(createFederatedAuthenticatorResponse(identityProvider));
    idpResponse.setProvisioning(createProvisioningResponse(identityProvider));
    return idpResponse;
}
Also used : IdentityProviderResponse(org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderResponse)

Example 2 with IdentityProviderResponse

use of org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderResponse in project identity-api-server by wso2.

the class ServerIdpManagementService method patchIDP.

/**
 * Updates only root level attributes of IDP.
 *
 * @param identityProviderId Identity Provider resource ID.
 * @param patchRequest       Patch request in Json Patch notation See
 *                           <a href="https://tools.ietf.org/html/rfc6902">https://tools.ietf
 *                           .org/html/rfc6902</a>.
 *                           We support only Patch 'replace' operation on root level attributes of an Identity
 *                           Provider.
 */
public IdentityProviderResponse patchIDP(String identityProviderId, List<Patch> patchRequest) {
    try {
        IdentityProvider identityProvider = IdentityProviderServiceHolder.getIdentityProviderManager().getIdPByResourceId(identityProviderId, ContextLoader.getTenantDomainFromContext(), true);
        if (identityProvider == null) {
            throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_IDP_NOT_FOUND, identityProviderId);
        }
        IdentityProvider idpToUpdate = createIdPClone(identityProvider);
        processPatchRequest(patchRequest, idpToUpdate);
        IdentityProvider updatedIdP = IdentityProviderServiceHolder.getIdentityProviderManager().updateIdPByResourceId(identityProviderId, idpToUpdate, ContextLoader.getTenantDomainFromContext());
        return createIDPResponse(updatedIdP);
    } catch (IdentityProviderManagementException e) {
        throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_IDP, identityProviderId);
    }
}
Also used : IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) IdentityProviderManagementException(org.wso2.carbon.idp.mgt.IdentityProviderManagementException)

Example 3 with IdentityProviderResponse

use of org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderResponse in project identity-api-server by wso2.

the class IdentityProvidersApiServiceImpl method addIDP.

@Override
public Response addIDP(IdentityProviderPOSTRequest identityProviderPOSTRequest) {
    IdentityProviderResponse idPResponse = idpManagementService.addIDP(identityProviderPOSTRequest);
    URI location = ContextLoader.buildURIForHeader(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT + "/" + idPResponse.getId());
    return Response.created(location).entity(idPResponse).build();
}
Also used : IdentityProviderResponse(org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderResponse) URI(java.net.URI)

Aggregations

IdentityProviderResponse (org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderResponse)2 URI (java.net.URI)1 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)1 IdentityProviderManagementException (org.wso2.carbon.idp.mgt.IdentityProviderManagementException)1