Package net.shibboleth.idp.cas.service
Class DefaultServiceComparator
java.lang.Object
net.shibboleth.idp.cas.service.DefaultServiceComparator
- All Implemented Interfaces:
Comparator<String>
Default comparator implementation for comparing CAS service URLs. URL comparison is case-insensitive by default
and supports ignoring predefined URL path parameters. The common session marker ;jessionid=value is
ignored by default.
A future version MAY change the default to case-sensitive.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether the check should be case-sensitive.private final Pattern[]Ignored patterns in path part of URL.private final org.slf4j.LoggerClass logger. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance that ignores ;jsessionid=value.DefaultServiceComparator(String... parameterNames) Creates a new instance that ignores the given path parameter names (and any associated values). -
Method Summary
Modifier and TypeMethodDescriptionintvoidsetCaseSensitive(boolean flag) Sets whether the eventual comparison is case-sensitive.private StringstripPathParameters(String uriString) Strips any of the named path parameters (and any associated values) from the given URI.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
ignoredPatterns
Ignored patterns in path part of URL. -
caseSensitive
private boolean caseSensitiveWhether the check should be case-sensitive.
-
-
Constructor Details
-
DefaultServiceComparator
public DefaultServiceComparator()Creates a new instance that ignores ;jsessionid=value. -
DefaultServiceComparator
Creates a new instance that ignores the given path parameter names (and any associated values).- Parameters:
parameterNames- List of path parameter names to ignore.
-
-
Method Details
-
setCaseSensitive
public void setCaseSensitive(boolean flag) Sets whether the eventual comparison is case-sensitive.Defaults to false.
- Parameters:
flag-
-
compare
- Specified by:
comparein interfaceComparator<String>
-
stripPathParameters
Strips any of the named path parameters (and any associated values) from the given URI.- Parameters:
uriString- String form of URI from which to strip named path parameters.- Returns:
- URI with named path parameters and any associated values removed.
-