updated README. Removed the "serviceaccount" package. It has been moved
in the `cms-plugin-framework`
This commit is contained in:
parent
b6c096cbd1
commit
b5350f5143
|
@ -94,14 +94,14 @@ and
|
|||
|
||||
e.g. Messages using the placeholders:
|
||||
|
||||
```txt
|
||||
```properties
|
||||
# REVIEW ACTION
|
||||
TITLE_REVIEW_REQUIRED=Review required for ${project_name}
|
||||
MSG_REVIEW_REQUIRED=@${user_caller} submitted the project ${project_name}. You are kindly requested to review it and decide either to APPROVE or REJECT it. See the Project at ${private_data_entry_link}
|
||||
# REJECTED ACTION
|
||||
TITLE_ITEM_REJECTED=Rejected ${project_name}
|
||||
MSG_ITEM_REJECTED=The project ${project_name} (id: ${project_id}) has just been rejected by @${user_caller}. See the Project at ${private_data_entry_link}
|
||||
# REJECTED ACTION
|
||||
# REJECTED ACTION - REVIEW REQUIRED
|
||||
TITLE_ITEM_REJECTED_REVIEW_REQUIRED=Rejected ${project_name}
|
||||
MSG_ITEM_REJECTED_REVIEW_REQUIRED=The project ${project_name} has just been rejected. You are kindly requested to review it. See the Project at ${private_data_entry_link}
|
||||
```
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
//package org.gcube.application.cms.notifications.config.serviceaccount;
|
||||
//
|
||||
//import java.util.AbstractMap.SimpleEntry;
|
||||
//import java.util.Map.Entry;
|
||||
//
|
||||
//import javax.ws.rs.InternalServerErrorException;
|
||||
//
|
||||
//import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
//import org.gcube.common.authorization.utils.secret.JWTSecret;
|
||||
//import org.gcube.common.authorization.utils.secret.Secret;
|
||||
//import org.gcube.common.keycloak.KeycloakClientFactory;
|
||||
//import org.gcube.common.keycloak.model.TokenResponse;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
//@Slf4j
|
||||
//public class GeoportalServiceAccount {
|
||||
//
|
||||
// //geoportal service account config property file
|
||||
// protected static final String CLIENT_ID_PROPERTY_NAME = "clientId";
|
||||
//
|
||||
// private static String clientId = "geoportal";
|
||||
//
|
||||
// private static Entry<String, String> getClientIdAndClientSecret(String context) {
|
||||
// try {
|
||||
// IAMClientCredentials credentials = IAMClientCredentialsReader.getCredentials();
|
||||
//
|
||||
// clientId = credentials.getClientId()==null?clientId:credentials.getClientId();
|
||||
// String clientSecret = credentials.getClientSecret();
|
||||
// SimpleEntry<String, String> entry = new SimpleEntry<String, String>(clientId, clientSecret);
|
||||
// return entry;
|
||||
// } catch(Exception e) {
|
||||
// throw new InternalServerErrorException(
|
||||
// "Unable to retrieve Application Token for context " + SecretManagerProvider.instance.get().getContext(), e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static TokenResponse getJWTAccessToken() throws Exception {
|
||||
// String context = SecretManagerProvider.instance.get().getContext();
|
||||
// Entry<String,String> entry = getClientIdAndClientSecret(context);
|
||||
// TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(context, entry.getKey(), entry.getValue(), context, null);
|
||||
// return tr;
|
||||
// }
|
||||
//
|
||||
// public static Secret getGeoportalSecret() throws Exception {
|
||||
// TokenResponse tr = getJWTAccessToken();
|
||||
// Secret secret = new JWTSecret(tr.getAccessToken());
|
||||
// return secret;
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -1,90 +0,0 @@
|
|||
//package org.gcube.application.cms.notifications.config.serviceaccount;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//
|
||||
///**
|
||||
// * The Class IAMClientCredentials.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
// *
|
||||
// * Sep 23, 2021
|
||||
// */
|
||||
//public class IAMClientCredentials implements Serializable {
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// private static final long serialVersionUID = 7242909633989611318L;
|
||||
// private String clientId;
|
||||
// private String clientSecret;
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new IAM client credentials.
|
||||
// */
|
||||
// public IAMClientCredentials() {
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new IAM client credentials.
|
||||
// *
|
||||
// * @param clientId the client id
|
||||
// * @param clientSecret the client secret
|
||||
// */
|
||||
// public IAMClientCredentials(String clientId, String clientSecret) {
|
||||
// this.clientId = clientId;
|
||||
// this.clientSecret = clientSecret;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the client id.
|
||||
// *
|
||||
// * @return the client id
|
||||
// */
|
||||
// public String getClientId() {
|
||||
// return clientId;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the client secret.
|
||||
// *
|
||||
// * @return the client secret
|
||||
// */
|
||||
// public String getClientSecret() {
|
||||
// return clientSecret;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the client id.
|
||||
// *
|
||||
// * @param clientId the new client id
|
||||
// */
|
||||
// public void setClientId(String clientId) {
|
||||
// this.clientId = clientId;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the client secret.
|
||||
// *
|
||||
// * @param clientSecret the new client secret
|
||||
// */
|
||||
// public void setClientSecret(String clientSecret) {
|
||||
// this.clientSecret = clientSecret;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * To string.
|
||||
// *
|
||||
// * @return the string
|
||||
// */
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// StringBuilder builder = new StringBuilder();
|
||||
// builder.append("IAMClientCredentials [clientId=");
|
||||
// builder.append(clientId);
|
||||
// builder.append(", clientSecret=");
|
||||
// builder.append(clientSecret != null ? clientSecret.subSequence(0, 5) + "_MASKED_SECRET" : null);
|
||||
// builder.append("]");
|
||||
// return builder.toString();
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -1,82 +0,0 @@
|
|||
//package org.gcube.application.cms.notifications.config.serviceaccount;
|
||||
//
|
||||
//import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
//import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
//
|
||||
//import java.util.Collection;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
//import org.gcube.common.encryption.StringEncrypter;
|
||||
//import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
//import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
//import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
//import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
///**
|
||||
// * The Class GNABaseMapsResourceReader.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
// *
|
||||
// * Sep 23, 2021
|
||||
// */
|
||||
//@Slf4j
|
||||
//public class IAMClientCredentialsReader {
|
||||
//
|
||||
// private static final String SE_PROFILE_NAME = "geoportal";
|
||||
// private static final String SE_CATEGORY_NAME = "SystemWorkspaceClient";
|
||||
//
|
||||
// /**
|
||||
// * Gets the credentials.
|
||||
// *
|
||||
// * @return the credentials
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public static IAMClientCredentials getCredentials() throws Exception {
|
||||
//
|
||||
// String currentContext = SecretManagerProvider.instance.get().getContext();
|
||||
//
|
||||
// log.info("Searching SE in the scope: " + currentContext + " with profile name: " + SE_PROFILE_NAME
|
||||
// + " and category name: " + SE_CATEGORY_NAME);
|
||||
//
|
||||
// SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
// query.addCondition("$resource/Profile/Name/text() eq '" + SE_PROFILE_NAME + "'");
|
||||
// query.addCondition("$resource/Profile/Category/text() eq '" + SE_CATEGORY_NAME + "'");
|
||||
//
|
||||
// DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
// List<ServiceEndpoint> resources = client.submit(query);
|
||||
//
|
||||
// if (resources.size() > 0)
|
||||
// log.info("The query returned " + resources.size() + " ServiceEndpoint/s");
|
||||
// else
|
||||
// throw new RuntimeException("ServiceEndpoint not found. Searching for profile name '" + SE_PROFILE_NAME
|
||||
// + "' and category name '" + SE_CATEGORY_NAME + "' in the scope: " + currentContext);
|
||||
//
|
||||
// ServiceEndpoint se = resources.get(0);
|
||||
// Collection<AccessPoint> theAccessPoints = se.profile().accessPoints().asCollection();
|
||||
// String clientId = null;
|
||||
// String secredPwd = null;
|
||||
// for (AccessPoint accessPoint : theAccessPoints) {
|
||||
// clientId = accessPoint.username();
|
||||
// secredPwd = accessPoint.password();
|
||||
// log.debug("Found clientId: " + clientId + " and encrypted secret: " + secredPwd);
|
||||
// // decrypting the pwd
|
||||
// try {
|
||||
// if (secredPwd != null) {
|
||||
// secredPwd = StringEncrypter.getEncrypter().decrypt(secredPwd);
|
||||
// log.debug("Secret decrypted is: " + secredPwd.substring(0, secredPwd.length() / 2)
|
||||
// + "_MASKED_TOKEN_");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException("Error on decrypting the pwd: ", e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// log.info("Returning keycloack credentials for SE {} read from SE", SE_PROFILE_NAME);
|
||||
// return new IAMClientCredentials(clientId, secredPwd);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
Loading…
Reference in New Issue