Updated to Auth 2.0

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@131466 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-09-19 08:27:40 +00:00
parent f59b316f8f
commit d99a5301e6
2 changed files with 7 additions and 21 deletions

View File

@ -68,27 +68,11 @@ public class SessionUtil {
return aslSession;
}
public static String getToken(ASLSession aslSession) throws Exception {
public static String getToken(ASLSession aslSession)
throws Exception {
String token = null;
if (Constants.DEBUG_MODE) {
List<String> userRoles = new ArrayList<>();
userRoles.add(Constants.DEFAULT_ROLE);
/*
* if (aslSession.getUsername().compareTo("lucio.lelii") == 0)
* userRoles.add("VRE-Manager");
*/
try {
token = authorizationService().generateUserToken(
new UserInfo(aslSession.getUsername(), userRoles),
aslSession.getScope());
} catch (Exception e) {
logger.error("Error generating the token for test: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new Exception("Error generating the token for test: "
+ e.getLocalizedMessage());
}
token = Constants.DEFAULT_TOKEN;
} else {
token = aslSession.getSecurityToken();
}
@ -97,6 +81,7 @@ public class SessionUtil {
}
public static SClient getSClient(ASLSession aslSession, HttpSession session)
throws Exception {

View File

@ -16,10 +16,11 @@ public class Constants {
public static final String DATA_MINER_LANG = "DataMinerLang";
public static final String DATA_MINER_OPERATOR_ID = "OperatorId";
public static final String DEFAULT_USER = "giancarlo.panichi";
public final static String DEFAULT_SCOPE = "/gcube/devNext";
public final static String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548";
public static final String DEFAULT_ROLE = "OrganizationMember";
public static final String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
// public final static String DEFAULT_SCOPE = "/gcube/devNext";
//public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";