private String[] getNamePassword(HttpServletRequest httpRequest) { String authValue = httpRequest.getHeader("Authorization"); if (authValue != null && authValue.startsWith("Basic ")) { String encodedValue = authValue.substring(6); String decodedValue = new Base64(encodedValue).decodeToString(); final String[] namePassword = decodedValue.contains(":") ? decodedValue.split(":") : new String[] { decodedValue, "" }; return namePassword; } else if (httpRequest.getContentType().contains("application/x-www-form-urlencoded")) { String clientId = httpRequest.getParameter("client_id"); String clientSecret = httpRequest.getParameter("client_secret"); if (clientId == null || clientSecret == null) { return null; } return new String[]{clientId, clientSecret}; } else { return null; } }