@SuppressWarnings("restriction")
 public static byte[] decode(String raw) throws IOException {
   BASE64Decoder decoder = new BASE64Decoder();
   return decoder.decodeBuffer(raw);
 }
  public String[] decodeToken(String authHeader) {

    String result[] = new String[3];
    result[0] = "ERROR";

    if (authHeader != null) {
      System.out.println("Authorization Header gevonden");
      StringTokenizer st = new StringTokenizer(authHeader);
      if (st.hasMoreTokens()) {
        System.out.println("Tokens gevonden");

        String basic = st.nextToken();

        // We only handle HTTP Basic authentication

        if (basic.equalsIgnoreCase("Basic")) {
          System.out.println("Basic Authenticatie gevonden");
          String credentials = st.nextToken();
          System.out.println("Credentials gevonden : " + credentials);
          try {
            // String userPass =
            //   new String(DatatypeConverter.parseBase64Binary(credentials));

            @SuppressWarnings("restriction")
            BASE64Decoder decoder = new BASE64Decoder();
            @SuppressWarnings("restriction")
            String userPass = new String(decoder.decodeBuffer(credentials));
            System.out.println("credentials ontcijferd");
            // The decoded string is in the form
            // "userID:password".

            int p = userPass.indexOf(":");
            if (p != -1) {
              System.out.println("username/password correct met ':' gescheiden : " + userPass);

              String userName = userPass.substring(0, p);
              String password = userPass.substring(p + 1);
              System.out.println("username = "******"password = "******"")) && (!password.trim().equals(""))) {
                System.out.println("Request valid");
                result[0] = "OK";
                result[1] = userName;
                result[2] = password;
                return result;
              } else {
                result[0] = "ERROR";
                result[1] = "invalid, username of password leeg";
                result[2] = "";
                System.out.println(result[0] + " " + result[1]);
                return result;
              }
            } else {
              result[0] = "ERROR";
              result[1] = "username/password niet correct met : gescheiden";
              result[2] = "";
              System.out.println(result[0] + " " + result[1]);
              return result;
            }
          } catch (IOException e) {
            result[0] = "ERROR";
            result[1] = "Encyptie niet in het juiste format";
            result[2] = "";
            System.out.println(result[0] + " " + result[1]);
            return result;
          }
        } else {
          result[0] = "ERROR";
          result[1] = "Geen Basic Authenticatie gevonden";
          result[2] = "";
          System.out.println(result[0] + " " + result[1]);
          return result;
        }
      } else {
        result[0] = "ERROR";
        result[1] = "invalid, username of password leeg";
        result[2] = "";
        System.out.println(result[0] + " " + result[1]);
        return result;
      }
    } else {
      result[0] = "ERROR";
      result[1] = "Authorization Header niet gevonden";
      result[2] = "";
      System.out.println(result[0] + " " + result[1]);
      return result;
    }
  }