/** * Parse the username from the specified authorization credentials. * If none can be found, return <code>null</code>. * * @param authorization Authorization credentials from this request */ protected String parseUsername(String authorization) { if (authorization == null) return (null); if (!authorization.toLowerCase(Locale.ENGLISH).startsWith("basic ")) return (null); authorization = authorization.substring(6).trim(); // Decode and parse the authorization credentials String unencoded = new String(Base64.decode(authorization.getBytes(Charset.defaultCharset()))); int colon = unencoded.indexOf(':'); if (colon < 0) return (null); String username = unencoded.substring(0, colon); // String password = unencoded.substring(colon + 1).trim(); return (username); }
/** * Parse the password from the specified authorization credentials. * If none can be found, return <code>null</code>. * * @param authorization Authorization credentials from this request */ protected char[] parsePassword(String authorization) { if (authorization == null) return (null); if (!authorization.toLowerCase(Locale.ENGLISH).startsWith("basic ")) return (null); authorization = authorization.substring(6).trim(); // Decode and parse the authorization credentials String unencoded = new String(Base64.decode(authorization.getBytes(Charset.defaultCharset()))); int colon = unencoded.indexOf(':'); if (colon < 0) return (null); // String username = unencoded.substring(0, colon).trim(); char[] password = unencoded.substring(colon + 1).toCharArray(); return (password); }
Base64.decode(pwbc, decoded); char[] pwarray = decoded.getBuffer();
Base64.decode(pwbc, decoded); char[] pwarray = decoded.getBuffer();
Base64.decode(pwbc, decoded); char[] pwarray = decoded.getBuffer();
Base64.decode(pwbc, decoded); char[] pwarray = decoded.getBuffer();
Base64.decode(pwbc, decoded); char[] pwarray = decoded.getBuffer();
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, decoded);
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, authorizationCC);
Base64.decode(authorizationBC, authorizationCC);