We've upgraded from confluence 6.6 to 6.15.1
Issue
We're using following code to run REST API calls within a java app
String cred = java.util.Base64.getEncoder().encodeToString(("usr:passwd").getBytes());
HttpGet httpget = new HttpGet(restApiQuery);
httpget.addHeader("Authorization: Basic ", cred);
httpclient.execute(httpget);
This used to work in 6.6, however this is throwing an error in 6.15.1
<!doctype html><html lang="en"><head><title>HTTP Status 500 \u2013 Internal Server Error</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 \u2013 Internal Server Error</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Illegal base64 character 3a</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>java.lang.IllegalArgumentException: Illegal base64 character 3a
java.util.Base64$Decoder.decode0(Base64.java:714)
java.util.Base64$Decoder.decode(Base64.java:526)
java.util.Base64$Decoder.decode(Base64.java:549)
com.atlassian.seraph.util.SecurityUtils.decodeBasicAuthorizationCredentials(SecurityUtils.java:49)
com.atlassian.seraph.auth.DefaultAuthenticator.getUserFromBasicAuthentication(DefaultAuthenticator.java:510)
com.atlassian.crowd.integration.seraph.CrowdAuthenticator.checkAuthenticated(CrowdAuthenticator.java:296)
com.atlassian.crowd.integration.seraph.CrowdAuthenticator.getUser(CrowdAuthenticator.java:397)
com.atlassian.confluence.user.ConfluenceCrowdSSOAuthenticator.lambda$getUser$3(ConfluenceCrowdSSOAuthenticator.java:102)
....
I've notice that the encoding includes character = which apparently is for padding (for the sake of testing I also encoded user:passwd with withoutPadding, with no effect
Question
How to fix this?
The header was badly constructed, it should be
httpget.addHeader("Authorization", "Basic " + cred);
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.