updated path and config
This commit is contained in:
parent
182f890e9c
commit
9c6fa54d97
|
@ -2,7 +2,12 @@
|
|||
<web-app>
|
||||
<servlet>
|
||||
<servlet-name>org.gcube.idm.IdentityManagerResourceInitializer</servlet-name>
|
||||
<servlet-class>org.gcube.idm.IdentityManagerResourceInitializer</servlet-class>
|
||||
</servlet>
|
||||
<context-param>
|
||||
<param-name>resolver-basepath</param-name>
|
||||
<param-value>https://data-d.d4science.org/shub</param-value>
|
||||
</context-param>
|
||||
<servlet-mapping>
|
||||
<servlet-name>org.gcube.idm.IdentityManagerResourceInitializer</servlet-name>
|
||||
<url-pattern>/*</url-pattern>
|
14
pom.xml
14
pom.xml
|
@ -11,7 +11,7 @@
|
|||
<artifactId>identity-manager</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Identity Manager Service</name>
|
||||
<name>identity-manager</name>
|
||||
<description>Identity Manager Smargears Service</description>
|
||||
|
||||
<properties>
|
||||
|
@ -19,7 +19,7 @@
|
|||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<webappDirectory>
|
||||
${project.basedir}${file.separator}src${file.separator}main${file.separator}webapp${file.separator}WEB-INF</webappDirectory>
|
||||
${project.basedir}${file.separator}gcube${file.separator}extra-resources${file.separator}WEB-INF</webappDirectory>
|
||||
<enunciate.version>2.14.0</enunciate.version>
|
||||
</properties>
|
||||
|
||||
|
@ -81,10 +81,6 @@
|
|||
<artifactId>common-scope-maps</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>keycloak-client</artifactId>
|
||||
|
@ -95,11 +91,6 @@
|
|||
<version>21.0.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-encryption</artifactId>
|
||||
|
@ -220,6 +211,7 @@
|
|||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<attachClasses>true</attachClasses>
|
||||
<warName>../webapps/identity-manager</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.idm;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.gcube.idm.rest.TestRest;
|
||||
import org.gcube.idm.rest.UsersRest;
|
||||
|
@ -11,11 +12,8 @@ import org.glassfish.jersey.server.ResourceConfig;
|
|||
* @author Alfredo Oliviero (ISTI - CNR)
|
||||
*/
|
||||
|
||||
|
||||
// SMARTGEARS
|
||||
// legge i parametri del service da application.yaml
|
||||
|
||||
@ApplicationPath("/")
|
||||
//@Path("identity-manager")
|
||||
@ManagedBy(IdentityManagerdInitializator.class)
|
||||
public class IdentityManagerResourceInitializer extends ResourceConfig {
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package org.gcube.idm;
|
|||
|
||||
import org.gcube.common.security.providers.SecretManagerProvider;
|
||||
import org.gcube.smartgears.ApplicationManager;
|
||||
import org.gcube.smartgears.ContextProvider;
|
||||
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -23,7 +25,7 @@ public class IdentityManagerdInitializator implements ApplicationManager {
|
|||
@Override
|
||||
public synchronized void onInit() {
|
||||
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
ApplicationContext context = ContextProvider.get();
|
||||
|
||||
logger.info(
|
||||
"\n-------------------------------------------------------\n"
|
||||
|
@ -50,7 +52,7 @@ public class IdentityManagerdInitializator implements ApplicationManager {
|
|||
@Override
|
||||
public synchronized void onShutdown(){
|
||||
|
||||
String context = SecretManagerProvider.instance.get().getContext();
|
||||
ApplicationContext context = ContextProvider.get();
|
||||
|
||||
logger.trace(
|
||||
"\n-------------------------------------------------------\n"
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
|
|||
public class TestRest {
|
||||
|
||||
@GET
|
||||
@Path("/prova")
|
||||
@Path("prova")
|
||||
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
|
||||
public String test(){
|
||||
return "{}";
|
||||
|
|
|
@ -11,17 +11,10 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.common.authorization.library.policies.Users;
|
||||
import org.gcube.common.security.Owner;
|
||||
import org.gcube.common.security.providers.SecretManagerProvider;
|
||||
import org.gcube.keycloak.KeycloakApiClient;
|
||||
import org.gcube.keycloak.KeycloakAPIFactory;
|
||||
import org.gcube.keycloak.KeycloakApiClient;
|
||||
import org.gcube.rest.ResponseBean;
|
||||
import org.gcube.smartgears.ContextProvider;
|
||||
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||
import org.gcube.smartgears.security.SimpleCredentials;
|
||||
import org.gcube.smartgears.security.defaults.DefaultAuthorizationProvider;
|
||||
import org.gcube.smartgears.utils.InnerMethodName;
|
||||
import org.jboss.resteasy.spi.NotImplementedYetException;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.representations.idm.UserRepresentation;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -50,8 +43,8 @@ public class UsersRest {
|
|||
|
||||
List<String> usernames = new ArrayList<String>();
|
||||
try {
|
||||
String ctx = SecretManagerProvider.instance.get().getContext();
|
||||
KeycloakApiClient keycloakApiClient = KeycloakAPIFactory.getSingleton().createtKeycloakInstance(ctx);
|
||||
String currentContext = SecretManagerProvider.instance.get().getContext();
|
||||
KeycloakApiClient keycloakApiClient = KeycloakAPIFactory.getSingleton().createtKeycloakInstance(currentContext);
|
||||
|
||||
List<UserRepresentation> users = searchByRole(keycloakApiClient, roleName);
|
||||
if (users != null) {
|
||||
|
@ -96,15 +89,17 @@ public class UsersRest {
|
|||
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
|
||||
public String getCurrentProfile() {
|
||||
// SMARTGEARS Specializza il tracciamento della chiamata su Accounting
|
||||
InnerMethodName.instance.set("getCurrentProfile");
|
||||
Owner owner = SecretManagerProvider.instance.get().getOwner();
|
||||
|
||||
ApplicationContext appContext = ContextProvider.get();
|
||||
SimpleCredentials credentials = ((DefaultAuthorizationProvider) appContext.container().authorizationProvider())
|
||||
.getCredentials();
|
||||
|
||||
String ctx = SecretManagerProvider.instance.get().getContext();
|
||||
KeycloakApiClient keycloakApiClient = KeycloakAPIFactory.getSingleton().createtKeycloakInstance(ctx);
|
||||
// InnerMethodName.instance.set("getCurrentProfile");
|
||||
// Owner owner = SecretManagerProvider.instance.get().getOwner();
|
||||
//
|
||||
// ApplicationContext appContext = ContextProvider.get();
|
||||
// SimpleCredentials credentials = ((DefaultAuthorizationProvider)
|
||||
// appContext.container().authorizationProvider())
|
||||
// .getCredentials();
|
||||
//
|
||||
// String ctx = SecretManagerProvider.instance.get().getContext();
|
||||
// KeycloakApiClient keycloakApiClient =
|
||||
// KeycloakAPIFactory.getSingleton().createtKeycloakInstance(ctx);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -112,42 +107,48 @@ public class UsersRest {
|
|||
@Path("/get-email")
|
||||
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
|
||||
public String getCurrentEmail() {
|
||||
throw new NotImplementedYetException();
|
||||
// throw new NotImplementedYetException\(\);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/get-fullname")
|
||||
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
|
||||
public String getCurrentFullname() {
|
||||
throw new NotImplementedYetException();
|
||||
// throw new NotImplementedYetException\(\);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/get-all-usernames")
|
||||
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
|
||||
public String getAllUsernames() {
|
||||
throw new NotImplementedYetException();
|
||||
// throw new NotImplementedYetException\(\);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/get-all-fullnames-and-usernames")
|
||||
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
|
||||
public String getAllUsernamesFullnames() {
|
||||
throw new NotImplementedYetException();
|
||||
// throw new NotImplementedYetException\(\);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/user-exists")
|
||||
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
|
||||
public boolean checkUserExists() {
|
||||
throw new NotImplementedYetException();
|
||||
public Boolean checkUserExists() {
|
||||
// throw new NotImplementedYetException\(\);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/get-oauth-profile")
|
||||
@Produces({ "application/json;charset=UTF-8", "application/vnd.api+json" })
|
||||
public boolean getCurrentOAuthProfile() {
|
||||
throw new NotImplementedYetException();
|
||||
public String getCurrentOAuthProfile() {
|
||||
// throw new NotImplementedYetException\(\);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue