Compare commits
29 Commits
feature/24
...
master
Author | SHA1 | Date |
---|---|---|
Roberto Cirillo | 86e9db2230 | |
Roberto Cirillo | acd016e1f2 | |
Roberto Cirillo | 8eb58fd6f4 | |
Roberto Cirillo | c11fb3b44d | |
Roberto Cirillo | 83240cb40f | |
Roberto Cirillo | 6f7dd0e4f2 | |
Roberto Cirillo | 26f9460cf3 | |
Roberto Cirillo | e35f2cd199 | |
Roberto Cirillo | 1e438436d5 | |
Roberto Cirillo | d6a6075f5a | |
Roberto Cirillo | d1d2d667e0 | |
Roberto Cirillo | 8aa338a5b6 | |
Roberto Cirillo | a49ef41abd | |
Roberto Cirillo | 14efce90a4 | |
Roberto Cirillo | aaa8cdd631 | |
Roberto Cirillo | 280e6877b5 | |
Roberto Cirillo | ee1560cce3 | |
Roberto Cirillo | fdb7fd354d | |
Roberto Cirillo | 5d4793210e | |
Roberto Cirillo | 09c6155a45 | |
Roberto Cirillo | aba203b651 | |
Roberto Cirillo | d53a917c45 | |
Roberto Cirillo | 5b9f1d927f | |
Roberto Cirillo | b064f74fbd | |
Roberto Cirillo | c939f13fad | |
Roberto Cirillo | b70ed135e9 | |
Roberto Cirillo | cb4b10caf0 | |
Roberto Cirillo | 039dbccd98 | |
Roberto Cirillo | 03794cbc9c |
|
@ -3,20 +3,24 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [v1.3.0-SNAPSHOT] - [2023-01-27]
|
## [v1.4.0] - [2023-03-09]
|
||||||
|
|
||||||
|
- Feature #24254 simple serviceEndpoint creation
|
||||||
- add support for UMA token
|
- add support for UMA token
|
||||||
- Feature #24253 add support for decrypted ServiceEndpoint
|
- Feature #24253 add support for decrypted ServiceEndpoint
|
||||||
- update lombok library to 1.18.4 with scope provided
|
- update lombok library to 1.18.4 with scope provided
|
||||||
|
|
||||||
|
|
||||||
## [v1.2.0] - [2021-06-08]
|
## [v1.2.0] - [2021-06-08]
|
||||||
|
|
||||||
- Feature #21584 added support for /ServiceEndpoint/{category} REST call
|
- Feature #21584 added support for /ServiceEndpoint/{category} REST call
|
||||||
|
|
||||||
|
|
||||||
## [v1.1.0-SNAPSHOT] - [2016-10-03]
|
## [v1.1.0-SNAPSHOT] - [2016-10-03]
|
||||||
|
|
||||||
- porting to auth v.2
|
- porting to auth v.2
|
||||||
|
|
||||||
|
|
||||||
## [v1.0.0] - [2015-07-01]
|
## [v1.0.0] - [2015-07-01]
|
||||||
|
|
||||||
- First commit
|
- First commit
|
63
pom.xml
63
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>icproxy</artifactId>
|
<artifactId>icproxy</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.4.0</version>
|
||||||
<name>ICProxy</name>
|
<name>ICProxy</name>
|
||||||
|
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
@ -66,7 +66,6 @@
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
<artifactId>ic-client</artifactId>
|
<artifactId>ic-client</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resources</groupId>
|
<groupId>org.gcube.resources</groupId>
|
||||||
<artifactId>common-gcore-resources</artifactId>
|
<artifactId>common-gcore-resources</artifactId>
|
||||||
|
@ -82,31 +81,11 @@
|
||||||
<groupId>org.glassfish.jersey.containers</groupId>
|
<groupId>org.glassfish.jersey.containers</groupId>
|
||||||
<artifactId>jersey-container-servlet-core</artifactId>
|
<artifactId>jersey-container-servlet-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.containers</groupId>
|
<groupId>org.glassfish.jersey.containers</groupId>
|
||||||
<!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core" -->
|
<!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core" -->
|
||||||
<artifactId>jersey-container-servlet</artifactId>
|
<artifactId>jersey-container-servlet</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- lombok -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.18.4</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.test-framework</groupId>
|
<groupId>org.glassfish.jersey.test-framework</groupId>
|
||||||
<artifactId>jersey-test-framework-util</artifactId>
|
<artifactId>jersey-test-framework-util</artifactId>
|
||||||
|
@ -117,6 +96,30 @@
|
||||||
<artifactId>jersey-test-framework-provider-simple</artifactId>
|
<artifactId>jersey-test-framework-provider-simple</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- used for converting xml request in json request -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.media</groupId>
|
||||||
|
<artifactId>jersey-media-moxy</artifactId>
|
||||||
|
<version>2.39</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.4</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
@ -128,6 +131,22 @@
|
||||||
<artifactId>keycloak-client</artifactId>
|
<artifactId>keycloak-client</artifactId>
|
||||||
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- JAXB DEPS IN ORDER TO WORK WITH JDK11-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${artifactId}</finalName>
|
<finalName>${artifactId}</finalName>
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.gcube.informationsystem.icproxy.profiles;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement( name="resource")
|
||||||
|
public class ServiceEndpointProfile {
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String category;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String name;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String platform="d4science";
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String accessPointName;
|
||||||
|
@Getter
|
||||||
|
@Setter (AccessLevel.PROTECTED)
|
||||||
|
private String accessPointAddress;
|
||||||
|
@Getter
|
||||||
|
@Setter (AccessLevel.PROTECTED)
|
||||||
|
private String accessPointUsername;
|
||||||
|
@Getter
|
||||||
|
@Setter (AccessLevel.PROTECTED)
|
||||||
|
private String accessPointPass;
|
||||||
|
@Getter
|
||||||
|
@Setter (AccessLevel.PROTECTED)
|
||||||
|
private String host;
|
||||||
|
}
|
|
@ -15,6 +15,9 @@ import org.gcube.common.keycloak.model.ModelUtils;
|
||||||
import org.gcube.common.resources.gcore.*;
|
import org.gcube.common.resources.gcore.*;
|
||||||
import org.gcube.common.resources.gcore.utils.Group;
|
import org.gcube.common.resources.gcore.utils.Group;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.informationsystem.icproxy.profiles.ServiceEndpointProfile;
|
||||||
|
import org.gcube.informationsystem.publisher.RegistryPublisher;
|
||||||
|
import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
import org.gcube.common.encryption.StringEncrypter;
|
import org.gcube.common.encryption.StringEncrypter;
|
||||||
|
@ -23,14 +26,15 @@ import org.gcube.common.encryption.StringEncrypter;
|
||||||
@Path("ServiceEndpoint")
|
@Path("ServiceEndpoint")
|
||||||
public class ServiceEndpointResource {
|
public class ServiceEndpointResource {
|
||||||
|
|
||||||
|
public static final String DECRYPT_ROLE ="service-endpoint-key";
|
||||||
|
public static final String CREATE_ROLE ="is-resource-create";
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{category}")
|
@Path("/{category}")
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
public List<ServiceEndpoint> retrieve(@NotNull @PathParam("category") String resourceCategory) {
|
public List<ServiceEndpoint> retrieve(@NotNull @PathParam("category") String resourceCategory) {
|
||||||
log.info("ServiceEndpoint called with category {} in context {}",resourceCategory, ScopeProvider.instance.get());
|
log.info("ServiceEndpoint called with category {} in context {}",resourceCategory, ScopeProvider.instance.get());
|
||||||
|
|
||||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||||
|
|
||||||
List<ServiceEndpoint> endpoints = client.submit(getQuery(resourceCategory));
|
List<ServiceEndpoint> endpoints = client.submit(getQuery(resourceCategory));
|
||||||
log.debug("retrieved resources are "+endpoints.size());
|
log.debug("retrieved resources are "+endpoints.size());
|
||||||
return endpoints;
|
return endpoints;
|
||||||
|
@ -60,26 +64,72 @@ public class ServiceEndpointResource {
|
||||||
@NotNull @PathParam("category") String resourceCategory, @NotNull @PathParam("result") String resultXPath) {
|
@NotNull @PathParam("category") String resourceCategory, @NotNull @PathParam("result") String resultXPath) {
|
||||||
log.info("ServiceEndpoint called with category {} and name {} and result {} in scope {}"
|
log.info("ServiceEndpoint called with category {} and name {} and result {} in scope {}"
|
||||||
,resourceCategory, resourceName, resultXPath, ScopeProvider.instance.get());
|
,resourceCategory, resourceName, resultXPath, ScopeProvider.instance.get());
|
||||||
|
|
||||||
SimpleQuery query = getQuery(resourceName, resourceCategory);
|
SimpleQuery query = getQuery(resourceName, resourceCategory);
|
||||||
|
|
||||||
if (resultXPath.startsWith("/"))
|
if (resultXPath.startsWith("/"))
|
||||||
query.setResult("$resource"+resultXPath);
|
query.setResult("$resource"+resultXPath);
|
||||||
else
|
else
|
||||||
query.setResult("$resource/"+resultXPath);
|
query.setResult("$resource/"+resultXPath);
|
||||||
|
|
||||||
DiscoveryClient<String> client = client();
|
DiscoveryClient<String> client = client();
|
||||||
List<String> endpoints = client.submit(query);
|
List<String> endpoints = client.submit(query);
|
||||||
StringBuilder builder = new StringBuilder("<Results>");
|
StringBuilder builder = new StringBuilder("<Results>");
|
||||||
for (String single: endpoints)
|
for (String single: endpoints)
|
||||||
builder.append("<Result>").append(single.replaceAll("\n", "")).append("</Result>");
|
builder.append("<Result>").append(single.replaceAll("\n", "")).append("</Result>");
|
||||||
|
|
||||||
builder.append("</Results>");
|
builder.append("</Results>");
|
||||||
|
|
||||||
log.debug("retrieved resources are "+endpoints.size());
|
log.debug("retrieved resources are "+endpoints.size());
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for creating a new ServiceEndpoint resource starting from a XML resource as input param
|
||||||
|
* @param resourceProfile a complete ServiceEndpoint resource in XML
|
||||||
|
* @return the resource id
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Produces(MediaType.TEXT_PLAIN)
|
||||||
|
@Consumes(MediaType.APPLICATION_XML)
|
||||||
|
public String create(ServiceEndpoint resourceProfile) {
|
||||||
|
log.debug("Try to create new serviceEndpoint profile {} in {}",resourceProfile, ScopeProvider.instance.get());
|
||||||
|
if (Objects.nonNull(resourceProfile) && isRoleEnabled(CREATE_ROLE)){
|
||||||
|
log.debug("going to encrypt and push");
|
||||||
|
String id=registerSE(encryptResource(resourceProfile));
|
||||||
|
log.debug("pushed on IS");
|
||||||
|
return id;
|
||||||
|
}else{
|
||||||
|
throw new RuntimeException("ServiceEndpoint profile is null or user not enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for creating a new ServiceEndpoint resource starting from a simplified JSON resource
|
||||||
|
* @param resourceProfile a simplified JSON resource defined by ServiceEndpointProfile class
|
||||||
|
* @return the new resource created in XML format
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public ServiceEndpoint create(ServiceEndpointProfile resourceProfile) {
|
||||||
|
log.debug("Try to create new serviceEndpoint profile {} in {}",resourceProfile, ScopeProvider.instance.get());
|
||||||
|
if (Objects.nonNull(resourceProfile) && isRoleEnabled(CREATE_ROLE)){
|
||||||
|
ServiceEndpoint newResource= new ServiceEndpoint();
|
||||||
|
ServiceEndpoint.Profile profile=newResource.newProfile().category(resourceProfile.getCategory()).name(resourceProfile.getName());
|
||||||
|
profile.newPlatform().name(resourceProfile.getPlatform()).version((short)1).minorVersion((short)0).revisionVersion((short)0).buildVersion((short)0);
|
||||||
|
profile.newRuntime().hostedOn(resourceProfile.getHost()).status("ready").ghnId("");
|
||||||
|
ServiceEndpoint.AccessPoint ap=new ServiceEndpoint.AccessPoint();
|
||||||
|
ap.name(resourceProfile.getAccessPointName());
|
||||||
|
ap.address(resourceProfile.getAccessPointAddress());
|
||||||
|
ap.credentials(resourceProfile.getAccessPointPass(), resourceProfile.getAccessPointUsername());
|
||||||
|
profile.accessPoints().add(ap);
|
||||||
|
log.debug("going to encrypt and push");
|
||||||
|
registerSE(encryptResource(newResource));
|
||||||
|
log.debug("pushed on IS");
|
||||||
|
return newResource;
|
||||||
|
}else{
|
||||||
|
throw new RuntimeException("ServiceEndpoint profile is null or user not enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private SimpleQuery getQuery(String resourceName, String resourceCategory){
|
private SimpleQuery getQuery(String resourceName, String resourceCategory){
|
||||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
query.addCondition(String.format("$resource/Profile/Name/text() eq '%s'",resourceName));
|
query.addCondition(String.format("$resource/Profile/Name/text() eq '%s'",resourceName));
|
||||||
|
@ -94,6 +144,7 @@ public class ServiceEndpointResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceEndpoint decryptResource(ServiceEndpoint resource) {
|
private ServiceEndpoint decryptResource(ServiceEndpoint resource) {
|
||||||
|
log.debug("encrypting serviceEndpoint {} ", resource.id());
|
||||||
Group<ServiceEndpoint.AccessPoint> aps=resource.profile().accessPoints();
|
Group<ServiceEndpoint.AccessPoint> aps=resource.profile().accessPoints();
|
||||||
for (ServiceEndpoint.AccessPoint ap : aps){
|
for (ServiceEndpoint.AccessPoint ap : aps){
|
||||||
String decrypted =decryptString(ap.password());
|
String decrypted =decryptString(ap.password());
|
||||||
|
@ -104,16 +155,39 @@ public class ServiceEndpointResource {
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ServiceEndpoint encryptResource(ServiceEndpoint resource) {
|
||||||
|
log.debug("encrypting serviceEndpoint {} ", resource.id());
|
||||||
|
Group<ServiceEndpoint.AccessPoint> aps=resource.profile().accessPoints();
|
||||||
|
for (ServiceEndpoint.AccessPoint ap : aps){
|
||||||
|
String decrypted =encryptString(ap.password());
|
||||||
|
String user= ap.username();
|
||||||
|
ap.credentials(decrypted, user);
|
||||||
|
}
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static String decryptString(String toDecrypt){
|
private static String decryptString(String toDecrypt){
|
||||||
|
log.debug("decrypting string");
|
||||||
try{
|
try{
|
||||||
return StringEncrypter.getEncrypter().decrypt(toDecrypt);
|
return StringEncrypter.getEncrypter().decrypt(toDecrypt);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
throw new RuntimeException("Unable to decrypt : "+toDecrypt,e);
|
throw new RuntimeException("Unable to decrypt : "+toDecrypt,e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String encryptString(String toEncrypt){
|
||||||
|
log.debug("encrypting string");
|
||||||
|
try{
|
||||||
|
return StringEncrypter.getEncrypter().encrypt(toEncrypt);
|
||||||
|
}catch(Exception e) {
|
||||||
|
throw new RuntimeException("Unable to encrypt : "+toEncrypt,e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<ServiceEndpoint> getServiceEndpoints(boolean isDecrypt, List<ServiceEndpoint> endpoints) {
|
private List<ServiceEndpoint> getServiceEndpoints(boolean isDecrypt, List<ServiceEndpoint> endpoints) {
|
||||||
if (isDecrypt) {
|
if (isDecrypt) {
|
||||||
if (isRoleEnabled()){
|
if (isRoleEnabled(DECRYPT_ROLE)){
|
||||||
List<ServiceEndpoint> ses = new ArrayList<>(endpoints.size());
|
List<ServiceEndpoint> ses = new ArrayList<>(endpoints.size());
|
||||||
for (ServiceEndpoint resource : endpoints) {
|
for (ServiceEndpoint resource : endpoints) {
|
||||||
ses.add(decryptResource(resource));
|
ses.add(decryptResource(resource));
|
||||||
|
@ -126,18 +200,33 @@ public class ServiceEndpointResource {
|
||||||
return endpoints;
|
return endpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRoleEnabled(){
|
private boolean isRoleEnabled(String role){
|
||||||
|
boolean isEnabled = false;
|
||||||
|
log.debug("checking role: "+role);
|
||||||
String at= AccessTokenProvider.instance.get();
|
String at= AccessTokenProvider.instance.get();
|
||||||
try{
|
try{
|
||||||
if (ModelUtils.getAccessTokenFrom(at).getRealmAccess().getRoles().contains("service-endpoint-key" )) {
|
if (ModelUtils.getAccessTokenFrom(at).getRealmAccess().getRoles().contains(role)) {
|
||||||
log.info("The client is authorized to see the resource as 'free-to-air'");
|
isEnabled=true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("token not retrieved properly: "+e.getMessage());
|
log.error("token not retrieved properly: "+e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
log.info("user not authorized, sorry");
|
log.debug("role enabled "+isEnabled);
|
||||||
return false;
|
return isEnabled;
|
||||||
|
}
|
||||||
|
private static String registerSE(ServiceEndpoint toRegister) {
|
||||||
|
log.trace("going to create a new ServiceEndpoint resource. registerSE method");
|
||||||
|
RegistryPublisher rp= RegistryPublisherFactory.create();
|
||||||
|
if(log.isDebugEnabled())
|
||||||
|
Resources.print(toRegister);
|
||||||
|
Resource r=rp.create(toRegister);
|
||||||
|
if (Objects.nonNull(r)) {
|
||||||
|
log.debug("resource registered with id " + r.id());
|
||||||
|
return r.id();
|
||||||
|
}else{
|
||||||
|
throw new RuntimeException("Creation failed, null returned: "+toRegister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue