if ("basic".equalsIgnoreCase(method)) { credentials = credentials.substring(space + 1); credentials = B64Code.decode(credentials, StandardCharsets.ISO_8859_1); int i = credentials.indexOf(':'); if (i > 0) {
/** * Base 64 decode as described in RFC 2045. * <p>Unlike {@link #decode(char[])}, extra whitespace is ignored. * @param encoded String to decode. * @return byte array containing the decoded form of the input. * @throws IllegalArgumentException if the input is not a valid * B64 encoding. */ public static byte[] decode(String encoded) { if (encoded==null) return null; ByteArrayOutputStream bout = new ByteArrayOutputStream(4*encoded.length()/3); decode(encoded, bout); return bout.toByteArray(); }
/** * Base 64 decode as described in RFC 2045. * <p>Unlike {@link #decode(char[])}, extra whitespace is ignored. * @param encoded String to decode. * @param charEncoding Character encoding * used to map the decoded bytes into a String. If null * the platforms default charset is used. * @return String decoded byte array. * @throws IllegalArgumentException if the input is not a valid * B64 encoding. */ @SuppressWarnings("DefaultCharset") public static String decode(String encoded, Charset charEncoding) { byte[] decoded=decode(encoded); if (charEncoding==null) return new String(decoded); return new String(decoded, charEncoding); }
/** * Base 64 decode as described in RFC 2045. * <p>Unlike {@link #decode(char[])}, extra whitespace is ignored. * @param encoded String to decode. * @param charEncoding String representing the character encoding * used to map the decoded bytes into a String. If null * the platforms default charset is used. * @return String decoded byte array. * @throws UnsupportedCharsetException if the encoding is not supported * @throws IllegalArgumentException if the input is not a valid * B64 encoding. */ @SuppressWarnings("DefaultCharset") public static String decode(String encoded,String charEncoding) { byte[] decoded=decode(encoded); if (charEncoding==null) return new String(decoded); return new String(decoded,Charset.forName(charEncoding)); }
@Override public int read() throws IOException { if (_buffer==null || _pos>= _buffer.length) { //Any CR and LF will be consumed by the readLine() call. //We need to put them back into the bytes returned from this //method because the parsing of the multipart content uses them //as markers to determine when we've reached the end of a part. _line = _in.readLine(); if (_line==null) return -1; //nothing left if (_line.startsWith("--")) _buffer=(_line+"\r\n").getBytes(); //boundary marking end of part else if (_line.length()==0) _buffer="\r\n".getBytes(); //blank line else { ByteArrayOutputStream baos = new ByteArrayOutputStream((4*_line.length()/3)+2); B64Code.decode(_line, baos); baos.write(13); baos.write(10); _buffer = baos.toByteArray(); } _pos=0; } return _buffer[_pos++]; } }
credentials = B64Code.decode(credentials, StandardCharsets.ISO_8859_1); int i = credentials.indexOf(':'); if (i>0)
public byte[] getToken() { if ( _token == null ) { _token = B64Code.decode(_encodedToken); } return _token; }
byte[] authToken = B64Code.decode(encodedAuthToken);
public byte[] getToken() { if ( _token == null ) { _token = B64Code.decode(_encodedToken); } return _token; }
public byte[] getToken() { if ( _token == null ) { _token = B64Code.decode(_encodedToken); } return _token; }
public byte[] getToken() { if ( _token == null ) { _token = B64Code.decode(_encodedToken); } return _token; }
public byte[] getToken() { if ( _token == null ) { _token = B64Code.decode(_encodedToken); } return _token; }
/** * Base 64 decode as described in RFC 2045. * <p>Unlike {@link #decode(char[])}, extra whitespace is ignored. * @param encoded String to decode. * @return byte array containing the decoded form of the input. * @throws IllegalArgumentException if the input is not a valid * B64 encoding. */ static public byte[] decode(String encoded) { if (encoded==null) return null; ByteArrayOutputStream bout = new ByteArrayOutputStream(4*encoded.length()/3); decode(encoded, bout); return bout.toByteArray(); }
/** * Base 64 decode as described in RFC 2045. * <p>Unlike {@link #decode(char[])}, extra whitespace is ignored. * @param encoded String to decode. * @return byte array containing the decoded form of the input. * @throws IllegalArgumentException if the input is not a valid * B64 encoding. */ static public byte[] decode(String encoded) { if (encoded==null) return null; ByteArrayOutputStream bout = new ByteArrayOutputStream(4*encoded.length()/3); decode(encoded, bout); return bout.toByteArray(); }
protected boolean login(Subject clientSubject, String credentials, String authMethod, MessageInfo messageInfo) throws IOException, UnsupportedCallbackException { credentials = credentials.substring(credentials.indexOf(' ')+1); credentials = B64Code.decode(credentials,StringUtil.__ISO_8859_1); int i = credentials.indexOf(':'); String userName = credentials.substring(0,i); String password = credentials.substring(i+1); return login(clientSubject, userName, new Password(password), authMethod, messageInfo); }
protected boolean login(Subject clientSubject, String credentials, String authMethod, MessageInfo messageInfo) throws IOException, UnsupportedCallbackException { credentials = credentials.substring(credentials.indexOf(' ')+1); credentials = B64Code.decode(credentials,StringUtil.__ISO_8859_1); int i = credentials.indexOf(':'); String userName = credentials.substring(0,i); String password = credentials.substring(i+1); return login(clientSubject, userName, new Password(password), authMethod, messageInfo); }
protected boolean login(Subject clientSubject, String credentials, String authMethod, MessageInfo messageInfo) throws IOException, UnsupportedCallbackException { credentials = credentials.substring(credentials.indexOf(' ')+1); credentials = B64Code.decode(credentials,StringUtil.__ISO_8859_1); int i = credentials.indexOf(':'); String userName = credentials.substring(0,i); String password = credentials.substring(i+1); return login(clientSubject, userName, new Password(password), authMethod, messageInfo); }
@Override public final <T> T deserialize(String o, Class<T> targetType) throws SerializerException { try { ByteArrayInputStream bais = new ByteArrayInputStream(B64Code.decode(o)); return targetType.cast(read(gzip ? new GZIPInputStream(bais) : bais)); } catch (Exception e) { throw new SerializerException("Error deserializing " + o + " : " + e.getMessage(), e); } }
@Override public void handle( Request request, HttpServletResponse response ) { String auth = request.getHeader("Authorization"); auth = auth.substring(auth.indexOf(' ') + 1); auth = B64Code.decode(auth, CHARSET_UTF8); int colon = auth.indexOf(':'); user.set(auth.substring(0, colon)); password.set(auth.substring(colon + 1)); response.setStatus(HTTP_OK); } };
@Override public void handle(Request request, HttpServletResponse response) { proxyHitCount.incrementAndGet(); String auth = request.getHeader("Proxy-Authorization"); auth = auth.substring(auth.indexOf(' ') + 1); auth = B64Code.decode(auth, CHARSET_UTF8); int colon = auth.indexOf(':'); proxyUser.set(auth.substring(0, colon)); proxyPassword.set(auth.substring(colon + 1)); request.setHandled(false); } };