code: private String findScope(String wildcard, String wildcardAuth, String auth) {
          String scope;
          String before = StringUtils.substringBefore(wildcardAuth, wildcard);
          String after = StringUtils.substringAfter(wildcardAuth, wildcard);
          if (StringUtils.startsWith(wildcardAuth, wildcard)) {
              scope = StringUtils.substringBefore(auth, after);
          } else if (StringUtils.endsWith(wildcardAuth, wildcard)) {
              scope = StringUtils.substringAfter(auth, before);
          } else {
              scope = StringUtils.substringBetween(auth, before, after);
          }
          return scope;
      }
docs: Finds the scope in a string that corresponds to a role with {wildcard}.<br>
  For example, if wildcardAuth is toto.{SCOPE} and auth is toto.foo then
  scope is foo.
  
  @param wildcard     the wildcard to search for
  @param wildcardAuth auth with {wildcard}
  @param auth         auth that corresponds
  @return the scope.