renamed constant

This commit is contained in:
Luca Frosini 2021-12-01 10:57:22 +01:00
parent 00ef2c1944
commit 82cc974d00
1 changed files with 3 additions and 3 deletions

View File

@ -19,13 +19,13 @@ import org.gcube.common.scope.impl.ScopeBean;
*/
public class GCubeSecret extends Secret {
public static final String TOKEN_REGEX = "^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}-[a-fA-F0-9]{8,9}){1}$";
public static final String GCUBE_TOKEN_REGEX = "^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}-[a-fA-F0-9]{8,9}){1}$";
@Override
protected void check(String token) throws AuthorizationException {
super.check(token);
if(!Pattern.matches(GCubeSecret.TOKEN_REGEX, token)) {
throw new AuthorizationException("The GUCBE token must comply with the regex " + TOKEN_REGEX);
if(!Pattern.matches(GCubeSecret.GCUBE_TOKEN_REGEX, token)) {
throw new AuthorizationException("The GUCBE token must comply with the regex " + GCUBE_TOKEN_REGEX);
}
}