added check for TokenUtils
This commit is contained in:
parent
95edfad9db
commit
f0fa56a7dd
|
@ -2,17 +2,18 @@ package org.gcube.portal.social.networking.ws.utils;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.ClientType;
|
import org.gcube.common.authorization.library.ClientType;
|
||||||
import org.gcube.common.authorization.library.utils.Caller;
|
import org.gcube.common.authorization.library.utils.Caller;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tokens utils methods
|
* Tokens utils methods
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
|
||||||
*/
|
*/
|
||||||
public class TokensUtils {
|
public class TokensUtils {
|
||||||
|
|
||||||
// a user context token (not qualified) has as qualifier the word "TOKEN"
|
// a user context token (not qualified) has as qualifier the word "TOKEN"
|
||||||
private static final String DEFAULT_QUALIFIER_USER_TOKEN = "TOKEN";
|
private static final String DEFAULT_QUALIFIER_USER_TOKEN = "TOKEN";
|
||||||
|
// Logger
|
||||||
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(TokensUtils.class);
|
||||||
/**
|
/**
|
||||||
* Check if it is a service token
|
* Check if it is a service token
|
||||||
* @return a boolean value
|
* @return a boolean value
|
||||||
|
@ -50,7 +51,8 @@ public class TokensUtils {
|
||||||
* Check if it is a user token
|
* Check if it is a user token
|
||||||
* @return a boolean value
|
* @return a boolean value
|
||||||
*/
|
*/
|
||||||
public static boolean isUserToken(Caller caller){
|
public static boolean isUserToken(Caller caller) {
|
||||||
|
logger.debug("\n ****** \n isUserToken: caller.getClient().getType().equals(ClientType.USER) => " + caller.getClient().getType().equals(ClientType.USER));
|
||||||
String username = caller.getClient().getId();
|
String username = caller.getClient().getId();
|
||||||
if (username.startsWith("service-account-")) {
|
if (username.startsWith("service-account-")) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue