Changes after review 1
Regex will now look for comma and spaces before realm. Preventing issues accepting params with realm as a suffix like blahrealm. Stops adding double commas when extracting realm param. Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
bc4ad7c61a
commit
29dccf668c
|
@ -42,7 +42,7 @@ public abstract class AuthenticationProtocolHandler implements ProtocolHandler
|
||||||
{
|
{
|
||||||
public static final int DEFAULT_MAX_CONTENT_LENGTH = 16*1024;
|
public static final int DEFAULT_MAX_CONTENT_LENGTH = 16*1024;
|
||||||
public static final Logger LOG = Log.getLogger(AuthenticationProtocolHandler.class);
|
public static final Logger LOG = Log.getLogger(AuthenticationProtocolHandler.class);
|
||||||
private static final Pattern AUTHENTICATE_PATTERN = Pattern.compile("([^\\s]+)\\s(.*)realm=\"([^\"]*)\"(.*)", Pattern.CASE_INSENSITIVE);
|
private static final Pattern AUTHENTICATE_PATTERN = Pattern.compile("([^\\s]+)\\s(.*,\\s*)?realm=\"([^\"]*)\"\\s*,?\\s*(.*)", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
private final HttpClient client;
|
private final HttpClient client;
|
||||||
private final int maxContentLength;
|
private final int maxContentLength;
|
||||||
|
@ -242,7 +242,12 @@ public abstract class AuthenticationProtocolHandler implements ProtocolHandler
|
||||||
{
|
{
|
||||||
String type = matcher.group(1);
|
String type = matcher.group(1);
|
||||||
String realm = matcher.group(3);
|
String realm = matcher.group(3);
|
||||||
String params = matcher.group(2) + matcher.group(4);
|
String params;
|
||||||
|
if(matcher.group(2) != null)
|
||||||
|
params = matcher.group(2) + matcher.group(4);
|
||||||
|
else
|
||||||
|
params = matcher.group(4);
|
||||||
|
|
||||||
Authentication.HeaderInfo headerInfo = new Authentication.HeaderInfo(type, realm, params, getAuthorizationHeader());
|
Authentication.HeaderInfo headerInfo = new Authentication.HeaderInfo(type, realm, params, getAuthorizationHeader());
|
||||||
result.add(headerInfo);
|
result.add(headerInfo);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue