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:
parent
f59b316f8f
commit
d99a5301e6
|
@ -68,27 +68,11 @@ public class SessionUtil {
|
||||||
return aslSession;
|
return aslSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getToken(ASLSession aslSession) throws Exception {
|
public static String getToken(ASLSession aslSession)
|
||||||
|
throws Exception {
|
||||||
String token = null;
|
String token = null;
|
||||||
if (Constants.DEBUG_MODE) {
|
if (Constants.DEBUG_MODE) {
|
||||||
List<String> userRoles = new ArrayList<>();
|
token = Constants.DEFAULT_TOKEN;
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
token = aslSession.getSecurityToken();
|
token = aslSession.getSecurityToken();
|
||||||
}
|
}
|
||||||
|
@ -97,6 +81,7 @@ public class SessionUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static SClient getSClient(ASLSession aslSession, HttpSession session)
|
public static SClient getSClient(ASLSession aslSession, HttpSession session)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,11 @@ public class Constants {
|
||||||
public static final String DATA_MINER_LANG = "DataMinerLang";
|
public static final String DATA_MINER_LANG = "DataMinerLang";
|
||||||
public static final String DATA_MINER_OPERATOR_ID = "OperatorId";
|
public static final String DATA_MINER_OPERATOR_ID = "OperatorId";
|
||||||
|
|
||||||
|
|
||||||
public static final String DEFAULT_USER = "giancarlo.panichi";
|
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_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";
|
||||||
//public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
|
//public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue