use of org.apache.cloudstack.api.response.IdpResponse in project cloudstack by apache.
the class ListIdpsCmd method authenticate.
@Override
public String authenticate(String command, Map<String, Object[]> params, HttpSession session, InetAddress remoteAddress, String responseType, StringBuilder auditTrailSb, HttpServletRequest req, HttpServletResponse resp) throws ServerApiException {
ListResponse<IdpResponse> response = new ListResponse<IdpResponse>();
List<IdpResponse> idpResponseList = new ArrayList<IdpResponse>();
for (SAMLProviderMetadata metadata : _samlAuthManager.getAllIdPMetadata()) {
if (metadata == null) {
continue;
}
IdpResponse idpResponse = new IdpResponse();
idpResponse.setId(metadata.getEntityId());
if (metadata.getOrganizationName() == null || metadata.getOrganizationName().isEmpty()) {
idpResponse.setOrgName(metadata.getEntityId());
} else {
idpResponse.setOrgName(metadata.getOrganizationName());
}
idpResponse.setOrgUrl(metadata.getOrganizationUrl());
idpResponse.setObjectName("idp");
idpResponseList.add(idpResponse);
}
response.setResponses(idpResponseList, idpResponseList.size());
response.setResponseName(getCommandName());
return ApiResponseSerializer.toSerializedString(response, responseType);
}
Aggregations