Search in sources :

Example 1 with CodeIntrospectResponse

use of org.wso2.carbon.identity.mgt.endpoint.util.client.model.CodeIntrospectResponse in project carbon-identity-framework by wso2.

the class LiteRegisterApi method introspectCode.

/**
 * This API is used to validate code of self registered lite users.
 *
 * @param code Code retried after lite user registration and optional property parameters (required)
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
public CodeIntrospectResponse introspectCode(CodeValidationRequest code) throws ApiException {
    Object localVarPostBody = code;
    // verify the required parameter 'code' is set
    if (code == null) {
        throw new ApiException(400, "Missing the required parameter 'code' when introspecting code");
    }
    String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
    List<Property> properties = code.getProperties();
    for (Property property : properties) {
        if (StringUtils.isNotEmpty(property.getKey()) && MultitenantConstants.TENANT_DOMAIN.equals(property.getKey())) {
            tenantDomain = property.getValue();
        }
    }
    basePath = IdentityManagementEndpointUtil.getBasePath(tenantDomain, IdentityManagementEndpointConstants.UserInfoRecovery.USER_API_RELATIVE_PATH);
    apiClient.setBasePath(basePath);
    // create path and map variables
    String localVarPath = "/introspect-code".replaceAll("\\{format\\}", "json");
    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    Map<String, String> localVarHeaderParams = new HashMap<String, String>();
    Map<String, Object> localVarFormParams = new HashMap<String, Object>();
    final String[] localVarAccepts = { "application/json" };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
    if (localVarAccept != null)
        localVarHeaderParams.put("Accept", localVarAccept);
    final String[] localVarContentTypes = { "application/json" };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
    localVarHeaderParams.put("Content-Type", localVarContentType);
    String[] localVarAuthNames = new String[] {};
    GenericType<CodeIntrospectResponse> localVarReturnType = new GenericType<CodeIntrospectResponse>() {
    };
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
Also used : CodeIntrospectResponse(org.wso2.carbon.identity.mgt.endpoint.util.client.model.CodeIntrospectResponse) GenericType(com.sun.jersey.api.client.GenericType) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Property(org.wso2.carbon.identity.mgt.endpoint.util.client.model.Property) ApiException(org.wso2.carbon.identity.mgt.endpoint.util.client.ApiException) Pair(org.wso2.carbon.identity.mgt.endpoint.util.client.Pair)

Aggregations

GenericType (com.sun.jersey.api.client.GenericType)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ApiException (org.wso2.carbon.identity.mgt.endpoint.util.client.ApiException)1 Pair (org.wso2.carbon.identity.mgt.endpoint.util.client.Pair)1 CodeIntrospectResponse (org.wso2.carbon.identity.mgt.endpoint.util.client.model.CodeIntrospectResponse)1 Property (org.wso2.carbon.identity.mgt.endpoint.util.client.model.Property)1