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"/>
</servlets> -->
<local-persistence location='target' />
<exclude>/disconnect/*</exclude>
<exclude>/gcube/service/disconnect/*</exclude>
</application>

View File

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

View File

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

View File

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

View File

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

View File

@ -23,6 +23,7 @@ import javax.xml.bind.DatatypeConverter;
import lombok.extern.slf4j.Slf4j;
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
@Path("connect/")
@ -68,6 +69,8 @@ public class Resource {
String scriptToExecute = context.getInitParameter("addUserScript");
if (AuthorizationProvider.instance.get().getClient().getId() == null ) return Response.serverError().build();
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();
return createResponse(AuthorizationProvider.instance.get().getClient().getId());
}

View File

@ -1,4 +1,4 @@
<body>
<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>