Search in sources :

Example 1 with KeyManagerInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerInfoDTO in project carbon-apimgt by wso2.

the class KeyManagerMappingUtil method toKeyManagerListDTO.

public static KeyManagerListDTO toKeyManagerListDTO(List<KeyManagerConfigurationDTO> keyManagerDTOList) {
    KeyManagerListDTO keyManagerListDTO = new KeyManagerListDTO();
    List<KeyManagerInfoDTO> keyManagerDTOS = new ArrayList<>();
    for (KeyManagerConfigurationDTO keyManagerConfigurationDTO : keyManagerDTOList) {
        keyManagerDTOS.add(toKeyManagerInfoDTO(keyManagerConfigurationDTO));
    }
    keyManagerListDTO.setList(keyManagerDTOS);
    keyManagerListDTO.setCount(keyManagerDTOS.size());
    return keyManagerListDTO;
}
Also used : KeyManagerConfigurationDTO(org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO) KeyManagerListDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerListDTO) ArrayList(java.util.ArrayList) KeyManagerInfoDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerInfoDTO)

Example 2 with KeyManagerInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerInfoDTO in project carbon-apimgt by wso2.

the class KeyManagerMappingUtil method toKeyManagerInfoDTO.

public static KeyManagerInfoDTO toKeyManagerInfoDTO(KeyManagerConfigurationDTO keyManagerConfigurationDTO) {
    KeyManagerInfoDTO keyManagerInfoDTO = new KeyManagerInfoDTO();
    keyManagerInfoDTO.setId(keyManagerConfigurationDTO.getUuid());
    keyManagerInfoDTO.setName(keyManagerConfigurationDTO.getName());
    keyManagerInfoDTO.setDescription(keyManagerConfigurationDTO.getDescription());
    keyManagerInfoDTO.setType(keyManagerConfigurationDTO.getType());
    keyManagerInfoDTO.setEnabled(keyManagerConfigurationDTO.isEnabled());
    keyManagerInfoDTO.setTokenType(KeyManagerInfoDTO.TokenTypeEnum.fromValue(keyManagerConfigurationDTO.getTokenType()));
    return keyManagerInfoDTO;
}
Also used : KeyManagerInfoDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerInfoDTO)

Example 3 with KeyManagerInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerInfoDTO in project carbon-apimgt by wso2.

the class KeyManagerMappingUtil method toKeyManagerListDto.

public static KeyManagerListDTO toKeyManagerListDto(List<KeyManagerConfigurationDTO> keyManagerConfigurations) {
    KeyManagerListDTO keyManagerListDTO = new KeyManagerListDTO();
    List<KeyManagerInfoDTO> keyManagerInfoDTOList = new ArrayList<>();
    for (KeyManagerConfigurationDTO keyManagerConfigurationDTO : keyManagerConfigurations) {
        keyManagerInfoDTOList.add(fromKeyManagerConfigurationDtoToKeyManagerInfoDto(keyManagerConfigurationDTO));
    }
    keyManagerListDTO.setList(keyManagerInfoDTOList);
    keyManagerListDTO.setCount(keyManagerInfoDTOList.size());
    return keyManagerListDTO;
}
Also used : KeyManagerConfigurationDTO(org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO) KeyManagerListDTO(org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerListDTO) ArrayList(java.util.ArrayList) KeyManagerInfoDTO(org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerInfoDTO)

Example 4 with KeyManagerInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerInfoDTO in project carbon-apimgt by wso2.

the class KeyManagerMappingUtil method fromKeyManagerConfigurationDtoToKeyManagerInfoDto.

private static KeyManagerInfoDTO fromKeyManagerConfigurationDtoToKeyManagerInfoDto(KeyManagerConfigurationDTO configurationDto) {
    KeyManagerInfoDTO keyManagerInfoDTO = new KeyManagerInfoDTO();
    keyManagerInfoDTO.setName(configurationDto.getName());
    keyManagerInfoDTO.setDisplayName(configurationDto.getDisplayName());
    keyManagerInfoDTO.setDescription(configurationDto.getDescription());
    keyManagerInfoDTO.setId(configurationDto.getUuid());
    keyManagerInfoDTO.setEnabled(configurationDto.isEnabled());
    keyManagerInfoDTO.setType(configurationDto.getType());
    return keyManagerInfoDTO;
}
Also used : KeyManagerInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.KeyManagerInfoDTO)

Example 5 with KeyManagerInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerInfoDTO in project carbon-apimgt by wso2.

the class MappingUtil method toKeyManagerInfoDTO.

/**
 * Converts RegistrationSummary key manager information into KeyManagerInfoDTO
 *
 * @param registrationSummary the registration summary required by gateway
 * @return KeyManagerInfoDTO
 */
private static KeyManagerInfoDTO toKeyManagerInfoDTO(RegistrationSummary registrationSummary) {
    KeyManagerInfoDTO keyManagerInfoDTO = new KeyManagerInfoDTO();
    keyManagerInfoDTO.setDcrEndpoint(registrationSummary.getKeyManagerInfo().getDcrEndpoint());
    keyManagerInfoDTO.setIntrospectEndpoint(registrationSummary.getKeyManagerInfo().getIntrospectEndpoint());
    keyManagerInfoDTO.setRevokeEndpoint(registrationSummary.getKeyManagerInfo().getRevokeEndpoint());
    keyManagerInfoDTO.setTokenEndpoint(registrationSummary.getKeyManagerInfo().getTokenEndpoint());
    CredentialsDTO keyManagerCredentials = new CredentialsDTO();
    keyManagerCredentials.setUsername(registrationSummary.getKeyManagerInfo().getCredentials().getUsername());
    keyManagerCredentials.setPassword(registrationSummary.getKeyManagerInfo().getCredentials().getPassword());
    keyManagerInfoDTO.setCredentials(keyManagerCredentials);
    return keyManagerInfoDTO;
}
Also used : CredentialsDTO(org.wso2.carbon.apimgt.rest.api.core.dto.CredentialsDTO) KeyManagerInfoDTO(org.wso2.carbon.apimgt.rest.api.core.dto.KeyManagerInfoDTO)

Aggregations

ArrayList (java.util.ArrayList)4 KeyManagerConfigurationDTO (org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO)3 KeyManagerInfoDTO (org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerInfoDTO)2 KeyManagerInfoDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.KeyManagerInfoDTO)2 KeyManagerInfoDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerInfoDTO)2 Gson (com.google.gson.Gson)1 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 HashMap (java.util.HashMap)1 List (java.util.List)1 KeyManagerListDTO (org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerListDTO)1 CredentialsDTO (org.wso2.carbon.apimgt.rest.api.core.dto.CredentialsDTO)1 KeyManagerInfoDTO (org.wso2.carbon.apimgt.rest.api.core.dto.KeyManagerInfoDTO)1 KeyManagerListDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.KeyManagerListDTO)1 KeyManagerListDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.KeyManagerListDTO)1