/** * Decodes a string using base64 and returns the result as another string. * * @param text String to be decoded. * @return Resulting decoded string. */ public static String decodeAsString(final String text) { return decodeAsString(text.getBytes()); } }
/** * Decodes a string using base64 and returns the result as another string. * * @param text String to be decoded. * @return Resulting decoded string. */ public static String decodeAsString(final String text) { return decodeAsString(text.getBytes()); } }
/** Construct a Builder based upon the "auth" field of the docker client config file. */ public static Builder forAuth(final String auth) { // split with limit=2 to catch case where password contains a colon final String[] authParams = Base64.decodeAsString(auth).split(":", 2); if (authParams.length != 2) { return builder(); } return builder() .username(authParams[0].trim()) .password(authParams[1].trim()); }
/** * Decodes a string using base64 and returns the result as another string. * * @param text String to be decoded. * @return Resulting decoded string. */ public static String decodeAsString(final String text) { return decodeAsString(text.getBytes()); } }
/** * Decodes a string using base64 and returns the result as another string. * * @param text String to be decoded. * @return Resulting decoded string. */ public static String decodeAsString(final String text) { return decodeAsString(text.getBytes()); } }
/** * Decodes a string using base64 and returns the result as another string. * * @param text String to be decoded. * @return Resulting decoded string. */ public static String decodeAsString(final String text) { return decodeAsString(text.getBytes()); } }
/** * Decodes a string using base64 and returns the result as another string. * * @param text String to be decoded. * @return Resulting decoded string. */ public static String decodeAsString(final String text) { return decodeAsString(text.getBytes()); } }
/** * Decodes a string using base64 and returns the result as another string. * * @param text String to be decoded. * @return Resulting decoded string. */ public static String decodeAsString(final String text) { return decodeAsString(text.getBytes()); } }
private String[] extractBasicAuthCredentials(String authorizationHeader) { if (authorizationHeader == null) { return null; } String[] schemeUserPass = new String[3]; String credentials; final String[] headerParts = authorizationHeader.split(" "); if (headerParts != null && headerParts.length == 2) { schemeUserPass[0] = headerParts[0].equalsIgnoreCase("basic") ? SecurityContext.BASIC_AUTH : null; credentials = Base64.decodeAsString(headerParts[1]); final String[] userPass = credentials.split(":"); if (userPass != null && userPass.length == 2) { schemeUserPass[1] = userPass[0].replaceAll("%40", "@"); schemeUserPass[2] = userPass[1]; } return schemeUserPass; } return null; }