This commit is contained in:
Lucio Lelii 2016-11-25 14:56:12 +00:00
parent 0a08820546
commit 4bbc11545f
7 changed files with 16 additions and 11 deletions

View File

@ -7,6 +7,6 @@
<servlet name="org.gcube.data.analysis.rconnector.RConnector" entryPointName="connector"/> <servlet name="org.gcube.data.analysis.rconnector.RConnector" entryPointName="connector"/>
</servlets> --> </servlets> -->
<local-persistence location='target' /> <local-persistence location='target' />
<exclude>/disconnect/*</exclude> <exclude>/gcube/service/disconnect/*</exclude>
</application> </application>

View File

@ -9,7 +9,7 @@
</context-param> </context-param>
<context-param> <context-param>
<param-name>addUserScript</param-name> <param-name>addUserScript</param-name>
<param-value>/root/Ruseradd.sh</param-value> <param-value>/usr/local/bin/rusersadd</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>storedKeyPath</param-name> <param-name>storedKeyPath</param-name>

View File

@ -75,17 +75,17 @@ public class ConfigFileWriter {
sb.append(info.getDatabase().getDatabaseAddress()+";"); sb.append(info.getDatabase().getDatabaseAddress()+";");
sb.append(info.getDatabase().getDatabaseName()+";"); sb.append(info.getDatabase().getDatabaseName()+";");
sb.append(info.getDatabase().getDatabaseUsername()+";"); sb.append(info.getDatabase().getDatabaseUsername()+";");
sb.append(info.getDatabase().getDatabasePassword()+"\n"); sb.append(info.getDatabase().getDatabasePassword()+";");
sb.append(info.getUsername()+";");
try{ sb.append(info.getToken()+"\n");
FileWriter fw = new FileWriter(pathToFile,false);
try(FileWriter fw = new FileWriter(pathToFile,false)){
fw.write(sb.toString()); fw.write(sb.toString());
fw.close();
log.debug("file written");
}catch(Exception e){ }catch(Exception e){
log.error("error writing config file",e); log.error("error writing config file",e);
return false; return false;
} }
log.debug("file written with line {}",sb.toString());
return true; return true;
} }
} }

View File

@ -5,7 +5,8 @@ import lombok.Data;
@Data @Data
public class Info { public class Info {
private String username =""; private String username ="";
private String token ="";
private String tableName ="" ; private String tableName ="" ;
private String userTableName ="" ; private String userTableName ="" ;
private String fields =""; private String fields ="";

View File

@ -12,6 +12,7 @@ import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.database.DatabaseEndpointIdentifier; import org.gcube.common.database.DatabaseEndpointIdentifier;
import org.gcube.common.database.DatabaseProvider; import org.gcube.common.database.DatabaseProvider;
import org.gcube.common.database.endpoint.DatabaseEndpoint; import org.gcube.common.database.endpoint.DatabaseEndpoint;
@ -61,7 +62,7 @@ public class InfoRetriever {
info.setQueryColumns(queryOrder.toString()); info.setQueryColumns(queryOrder.toString());
info.setUsername(userName); info.setUsername(userName);
info.setUserTableName(tr.getName()); info.setUserTableName(tr.getName());
info.setToken(SecurityTokenProvider.instance.get());
info.setDatabase(retrievedatabaseInfo()); info.setDatabase(retrievedatabaseInfo());
log.info("retrieved info are "+info); log.info("retrieved info are "+info);

View File

@ -23,6 +23,7 @@ import javax.xml.bind.DatatypeConverter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
@Path("connect/") @Path("connect/")
@ -68,6 +69,8 @@ public class Resource {
String scriptToExecute = context.getInitParameter("addUserScript"); String scriptToExecute = context.getInitParameter("addUserScript");
if (AuthorizationProvider.instance.get().getClient().getId() == null ) return Response.serverError().build(); if (AuthorizationProvider.instance.get().getClient().getId() == null ) return Response.serverError().build();
Info info = new Info(); Info info = new Info();
info.setUsername(AuthorizationProvider.instance.get().getClient().getId());
info.setToken(SecurityTokenProvider.instance.get());
if (!writer.write(info, AuthorizationProvider.instance.get().getClient().getId(), usersHome, filename, scriptToExecute)) return Response.serverError().build(); if (!writer.write(info, AuthorizationProvider.instance.get().getClient().getId(), usersHome, filename, scriptToExecute)) return Response.serverError().build();
return createResponse(AuthorizationProvider.instance.get().getClient().getId()); return createResponse(AuthorizationProvider.instance.get().getClient().getId());
} }

View File

@ -1,4 +1,4 @@
<body> <body>
<h2 style="text-align:center;">Rsutdio session inactive<h2> <h2 style="text-align:center;">Rsutdio session inactive<h2>
<h3 style="text-align:center;">log in using TabularData portlet from the i-marine portal<h3> <h3 style="text-align:center;">log in using from the portal<h3>
</body> </body>