mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-14 08:02:22 +00:00
SEC-219: Support complex tokenization scenarios.
This commit is contained in:
parent
14683dcbc7
commit
948f79e2e2
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2004 Acegi Technology Pty Limited
|
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -18,11 +18,10 @@ package org.acegisecurity.intercept.web;
|
|||||||
import org.acegisecurity.ConfigAttributeDefinition;
|
import org.acegisecurity.ConfigAttributeDefinition;
|
||||||
import org.acegisecurity.ConfigAttributeEditor;
|
import org.acegisecurity.ConfigAttributeEditor;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
import java.beans.PropertyEditorSupport;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@ -116,15 +115,21 @@ public class FilterInvocationDefinitionSourceEditor
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tokenize the line into its name/value tokens
|
if (line.lastIndexOf("==") != -1) {
|
||||||
String[] nameValue = StringUtils.delimitedListToStringArray(line, "=");
|
throw new IllegalArgumentException(
|
||||||
String name = nameValue[0];
|
"Only single equals should be used in line " + line);
|
||||||
String value = nameValue[1];
|
|
||||||
|
|
||||||
if(!StringUtils.hasLength(name) || !StringUtils.hasLength(value)) {
|
|
||||||
throw new IllegalArgumentException("Failed to parse a valid name/value pair from " + line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tokenize the line into its name/value tokens
|
||||||
|
// As per SEC-219, use the LAST equals as the delimiter between LHS and RHS
|
||||||
|
String name = StringUtils.substringBeforeLast(line, "=");
|
||||||
|
String value = StringUtils.substringAfterLast(line, "=");
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(name) || StringUtils.isBlank(value)) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Failed to parse a valid name/value pair from " + line);
|
||||||
|
}
|
||||||
|
|
||||||
// Convert value to series of security configuration attributes
|
// Convert value to series of security configuration attributes
|
||||||
ConfigAttributeEditor configAttribEd = new ConfigAttributeEditor();
|
ConfigAttributeEditor configAttribEd = new ConfigAttributeEditor();
|
||||||
configAttribEd.setAsText(value);
|
configAttribEd.setAsText(value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user