ScopedTest class get token from a property file which is ignored. So that there is no more possibility to commit token for mistake
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-publisher@133987 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
73f65aad08
commit
8ff76e17ea
|
@ -3,6 +3,10 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.publisher;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.gcube.common.authorization.client.Constants;
|
||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||
|
@ -21,7 +25,24 @@ public class ScopedTest {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ScopedTest.class);
|
||||
|
||||
private static final String TOKEN = "";
|
||||
protected static final String PROPERTIES_FILENAME = "config.properties";
|
||||
|
||||
private static final String TOKEN_VARNAME = "TOKEN";
|
||||
private static final String TOKEN;
|
||||
|
||||
static {
|
||||
Properties properties = new Properties();
|
||||
InputStream input = ScopedTest.class.getClassLoader().getResourceAsStream(PROPERTIES_FILENAME);
|
||||
|
||||
try {
|
||||
// load the properties file
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
TOKEN = properties.getProperty(TOKEN_VARNAME);
|
||||
}
|
||||
|
||||
private static String getCurrentScope() throws ObjectNotFound, Exception{
|
||||
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(TOKEN);
|
||||
|
|
Loading…
Reference in New Issue