Skip to content

Instantly share code, notes, and snippets.

@matzew
Created August 12, 2014 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/ed817310bc8ea523e536 to your computer and use it in GitHub Desktop.
Save matzew/ed817310bc8ea523e536 to your computer and use it in GitHub Desktop.
String password = "Basic ZWM4MjYwYjUtNWRiMi00NDNhLTkwZGItNjRlNDlkMTQ3YzIxOjRiMDlhOGI3LTg4ZGEtNGJjNi05MjJhLWM2NWZkNDAwNDVmMw==";
final HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
Mockito.when(request.getHeader("Authorization")).thenReturn(password);
final String[] credentials = HttpBasicHelper.extractUsernameAndPasswordFromBasicHeader(request);
System.out.println( credentials[0]);
System.out.println( credentials[1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment