fixed token utils to support both IAM and Legacy auth corner cases
This commit is contained in:
parent
c6a625d800
commit
26b8336f05
|
@ -28,7 +28,10 @@ public class TokensUtils {
|
||||||
* @return a boolean value
|
* @return a boolean value
|
||||||
*/
|
*/
|
||||||
public static boolean isApplicationToken(Caller caller){
|
public static boolean isApplicationToken(Caller caller){
|
||||||
|
String username = caller.getClient().getId();
|
||||||
|
if (username.startsWith("service-account-")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return caller.getClient().getType().equals(ClientType.EXTERNALSERVICE);
|
return caller.getClient().getType().equals(ClientType.EXTERNALSERVICE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +52,10 @@ public class TokensUtils {
|
||||||
*/
|
*/
|
||||||
public static boolean isUserToken(Caller caller){
|
public static boolean isUserToken(Caller caller){
|
||||||
String username = caller.getClient().getId();
|
String username = caller.getClient().getId();
|
||||||
return !username.startsWith("service-account-");
|
if (username.startsWith("service-account-")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return caller.getClient().getType().equals(ClientType.USER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +64,7 @@ public class TokensUtils {
|
||||||
* @return a boolean value
|
* @return a boolean value
|
||||||
*/
|
*/
|
||||||
public static boolean isUserTokenDefault(Caller caller){
|
public static boolean isUserTokenDefault(Caller caller){
|
||||||
|
return isUserToken(caller);
|
||||||
return caller.getClient().getType().equals(ClientType.USER);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue