fix compile errors
This commit is contained in:
parent
8eaec09704
commit
bab29c84f4
|
|
@ -96,10 +96,12 @@ public class AttributePrincipalImpl extends SimplePrincipal implements Attribute
|
|||
CommonUtils.assertNotNull(this.attributes, "attributes cannot be null.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAttributes() {
|
||||
return this.attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProxyTicketFor(String service) {
|
||||
if (proxyGrantingTicket != null) {
|
||||
return this.proxyRetriever.getProxyTicketIdFor(this.proxyGrantingTicket, service);
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
|
||||
if (!isIgnoreInitConfiguration()) {
|
||||
super.initInternal(filterConfig);
|
||||
|
|
@ -149,6 +150,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
|
|
@ -160,6 +162,7 @@ public class AuthenticationFilter extends AbstractCasFilter {
|
|||
CommonUtils.assertNotNull(this.casServerLoginUrl, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ public final class ContainsPatternUrlPatternMatcherStrategy implements UrlPatter
|
|||
|
||||
private String pattern;
|
||||
|
||||
@Override
|
||||
public boolean matches(final String url) {
|
||||
return url.contains(this.pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPattern(final String pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||
*/
|
||||
public final class DefaultAuthenticationRedirectStrategy implements AuthenticationRedirectStrategy {
|
||||
|
||||
@Override
|
||||
public void redirect(final HttpServletRequest request, final HttpServletResponse response,
|
||||
final String potentialRedirectUrl) throws IOException {
|
||||
final String potentialRedirectUrl) throws IOException {
|
||||
response.sendRedirect(potentialRedirectUrl);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public final class DefaultGatewayResolverImpl implements GatewayResolver {
|
|||
|
||||
public static final String CONST_CAS_GATEWAY = "_const_cas_gateway_";
|
||||
|
||||
@Override
|
||||
public boolean hasGatewayedAlready(final HttpServletRequest request, final String serviceUrl) {
|
||||
final HttpSession session = request.getSession(false);
|
||||
|
||||
|
|
@ -36,6 +37,7 @@ public final class DefaultGatewayResolverImpl implements GatewayResolver {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String storeGatewayInformation(final HttpServletRequest request, final String serviceUrl) {
|
||||
request.getSession(true).setAttribute(CONST_CAS_GATEWAY, "yes");
|
||||
return serviceUrl;
|
||||
|
|
|
|||
|
|
@ -41,10 +41,12 @@ public final class EntireRegionRegexUrlPatternMatcherStrategy implements UrlPatt
|
|||
this.setPattern(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final String url) {
|
||||
return this.pattern.matcher(url).matches();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPattern(final String pattern) {
|
||||
this.pattern = Pattern.compile(pattern);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,10 +35,12 @@ public final class ExactUrlPatternMatcherStrategy implements UrlPatternMatcherSt
|
|||
this.setPattern(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final String url) {
|
||||
return url.equals(this.pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPattern(final String pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ public final class FacesCompatibleAuthenticationRedirectStrategy implements Auth
|
|||
|
||||
private static final String FACES_PARTIAL_AJAX_PARAMETER = "javax.faces.partial.ajax";
|
||||
|
||||
@Override
|
||||
public void redirect(final HttpServletRequest request, final HttpServletResponse response,
|
||||
final String potentialRedirectUrl) throws IOException {
|
||||
final String potentialRedirectUrl) throws IOException {
|
||||
|
||||
if (CommonUtils.isNotBlank(request.getParameter(FACES_PARTIAL_AJAX_PARAMETER))) {
|
||||
// this is an ajax request - redirect ajaxly
|
||||
|
|
|
|||
|
|
@ -45,10 +45,12 @@ public final class RegexUrlPatternMatcherStrategy implements UrlPatternMatcherSt
|
|||
this.setPattern(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final String url) {
|
||||
return this.pattern.matcher(url).find();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPattern(final String pattern) {
|
||||
this.pattern = Pattern.compile(pattern);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,18 +49,22 @@ public final class SimpleGroup extends SimplePrincipal implements Group {
|
|||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addMember(final Principal user) {
|
||||
return this.members.add(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(final Principal member) {
|
||||
return this.members.contains(member);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<? extends Principal> members() {
|
||||
return Collections.enumeration(this.members);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeMember(final Principal user) {
|
||||
return this.members.remove(user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public class SimplePrincipal implements Principal, Serializable {
|
|||
CommonUtils.assertNotNull(this.name, "name cannot be null.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,40 +33,50 @@ public abstract class BaseConfigurationStrategy implements ConfigurationStrategy
|
|||
|
||||
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public final boolean getBoolean(final ConfigurationKey<Boolean> configurationKey) {
|
||||
return getValue(configurationKey, new Parser<Boolean>() {
|
||||
@Override
|
||||
public Boolean parse(final String value) {
|
||||
return CommonUtils.toBoolean(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public final long getLong(final ConfigurationKey<Long> configurationKey) {
|
||||
return getValue(configurationKey, new Parser<Long>() {
|
||||
@Override
|
||||
public Long parse(final String value) {
|
||||
return CommonUtils.toLong(value, configurationKey.getDefaultValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getInt(final ConfigurationKey<Integer> configurationKey) {
|
||||
return getValue(configurationKey, new Parser<Integer>() {
|
||||
@Override
|
||||
public Integer parse(final String value) {
|
||||
return CommonUtils.toInt(value, configurationKey.getDefaultValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getString(final ConfigurationKey<String> configurationKey) {
|
||||
return getValue(configurationKey, new Parser<String>() {
|
||||
@Override
|
||||
public String parse(final String value) {
|
||||
return value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Class<? extends T> getClass(final ConfigurationKey<Class<? extends T>> configurationKey) {
|
||||
return getValue(configurationKey, new Parser<Class<? extends T>>() {
|
||||
@Override
|
||||
public Class<? extends T> parse(final String value) {
|
||||
try {
|
||||
return ReflectUtils.loadClass(value);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public class JndiConfigurationStrategyImpl extends BaseConfigurationStrategy {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void init(final FilterConfig filterConfig, final Class<? extends Filter> clazz) {
|
||||
this.simpleFilterName = clazz.getSimpleName();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,13 @@ public final class LegacyConfigurationStrategyImpl extends BaseConfigurationStra
|
|||
|
||||
private final JndiConfigurationStrategyImpl jndiConfigurationStrategy = new JndiConfigurationStrategyImpl();
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig, Class<? extends Filter> filterClazz) {
|
||||
this.webXmlConfigurationStrategy.init(filterConfig, filterClazz);
|
||||
this.jndiConfigurationStrategy.init(filterConfig, filterClazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String get(final ConfigurationKey key) {
|
||||
final String value1 = this.webXmlConfigurationStrategy.get(key);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ public final class PropertiesConfigurationStrategyImpl extends BaseConfiguration
|
|||
return this.properties.getProperty(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig, final Class<? extends Filter> filterClazz) {
|
||||
this.simpleFilterName = filterClazz.getSimpleName();
|
||||
final String fileLocationFromFilterConfig = filterConfig.getInitParameter(CONFIGURATION_FILE_LOCATION);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import javax.servlet.FilterConfig;
|
|||
*/
|
||||
public class SystemPropertiesConfigurationStrategyImpl extends BaseConfigurationStrategy {
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig, Class<? extends Filter> filterClazz) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public final class WebXmlConfigurationStrategyImpl extends BaseConfigurationStra
|
|||
|
||||
private FilterConfig filterConfig;
|
||||
|
||||
@Override
|
||||
protected String get(final ConfigurationKey configurationKey) {
|
||||
final String value = this.filterConfig.getInitParameter(configurationKey.getName());
|
||||
|
||||
|
|
@ -54,6 +55,7 @@ public final class WebXmlConfigurationStrategyImpl extends BaseConfigurationStra
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig, final Class<? extends Filter> clazz) {
|
||||
this.filterConfig = filterConfig;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,8 +203,9 @@ public class CasLoginModule implements LoginModule {
|
|||
* names, e.g. DAYS, HOURS, MINUTES, SECONDS, MILLISECONDS. Default unit is MINUTES.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Override
|
||||
public final void initialize(final Subject subject, final CallbackHandler handler, final Map<String, ?> state,
|
||||
final Map<String, ?> options) {
|
||||
final Map<String, ?> options) {
|
||||
|
||||
this.assertion = null;
|
||||
this.callbackHandler = handler;
|
||||
|
|
@ -277,6 +278,7 @@ public class CasLoginModule implements LoginModule {
|
|||
// template method
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean login() throws LoginException {
|
||||
logger.debug("Performing login.");
|
||||
|
||||
|
|
@ -341,6 +343,7 @@ public class CasLoginModule implements LoginModule {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean abort() throws LoginException {
|
||||
if (this.ticket != null) {
|
||||
this.ticket = null;
|
||||
|
|
@ -369,6 +372,7 @@ public class CasLoginModule implements LoginModule {
|
|||
// template method
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean commit() throws LoginException {
|
||||
|
||||
if (!preCommit()) {
|
||||
|
|
@ -439,6 +443,7 @@ public class CasLoginModule implements LoginModule {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean logout() throws LoginException {
|
||||
logger.debug("Performing logout.");
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class ServiceAndTicketCallbackHandler implements CallbackHandler {
|
|||
this.ticket = ticket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
|
||||
for (final Callback callback : callbacks) {
|
||||
if (callback instanceof NameCallback) {
|
||||
|
|
|
|||
|
|
@ -55,8 +55,9 @@ public final class Servlet3AuthenticationFilter extends AbstractCasFilter {
|
|||
super(Protocol.CAS2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain chain) throws IOException, ServletException {
|
||||
final FilterChain chain) throws IOException, ServletException {
|
||||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
final HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
final HttpSession session = request.getSession();
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public final class TicketCredential implements Principal {
|
|||
this.ticket = ticket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.ticket;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,10 +60,12 @@ public abstract class AbstractEncryptedProxyGrantingTicketStorageImpl implements
|
|||
this.cipherAlgorithm = cipherAlgorithm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void save(final String proxyGrantingTicketIou, final String proxyGrantingTicket) {
|
||||
saveInternal(proxyGrantingTicketIou, encrypt(proxyGrantingTicket));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String retrieve(final String proxyGrantingTicketIou) {
|
||||
return decrypt(retrieveInternal(proxyGrantingTicketIou));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public final class Cas20ProxyRetriever implements ProxyRetriever {
|
|||
this.urlConnectionFactory = urlFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProxyTicketIdFor(final String proxyGrantingTicketId, final String targetService) {
|
||||
CommonUtils.assertNotNull(proxyGrantingTicketId, "proxyGrantingTicketId cannot be null.");
|
||||
CommonUtils.assertNotNull(targetService, "targetService cannot be null.");
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public final class CleanUpTimerTask extends TimerTask {
|
|||
this.proxyGrantingTicketStorage = proxyGrantingTicketStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.proxyGrantingTicketStorage.cleanUp();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ public final class ProxyGrantingTicketStorageImpl implements ProxyGrantingTicket
|
|||
* NOTE: you can only retrieve a ProxyGrantingTicket once with this method.
|
||||
* Its removed after retrieval.
|
||||
*/
|
||||
@Override
|
||||
public String retrieve(final String proxyGrantingTicketIou) {
|
||||
if (CommonUtils.isBlank(proxyGrantingTicketIou)) {
|
||||
return null;
|
||||
|
|
@ -97,6 +98,7 @@ public final class ProxyGrantingTicketStorageImpl implements ProxyGrantingTicket
|
|||
return holder.getProxyGrantingTicket();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(final String proxyGrantingTicketIou, final String proxyGrantingTicket) {
|
||||
final ProxyGrantingTicketHolder holder = new ProxyGrantingTicketHolder(proxyGrantingTicket);
|
||||
|
||||
|
|
@ -109,6 +111,7 @@ public final class ProxyGrantingTicketStorageImpl implements ProxyGrantingTicket
|
|||
* Cleans up old, expired proxy tickets. This method must be
|
||||
* called regularly via an external thread or timer.
|
||||
*/
|
||||
@Override
|
||||
public void cleanUp() {
|
||||
for (final Map.Entry<String, ProxyGrantingTicketHolder> holder : this.cache.entrySet()) {
|
||||
if (holder.getValue().isExpired(this.timeout)) {
|
||||
|
|
|
|||
|
|
@ -46,12 +46,14 @@ public final class HashMapBackedSessionMappingStorage implements SessionMappingS
|
|||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public synchronized void addSessionById(String mappingId, HttpSession session) {
|
||||
ID_TO_SESSION_KEY_MAPPING.put(session.getId(), mappingId);
|
||||
MANAGED_SESSIONS.put(mappingId, session);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void removeBySessionById(final String sessionId) {
|
||||
logger.debug("Attempting to remove Session=[{}]", sessionId);
|
||||
|
||||
|
|
@ -68,6 +70,7 @@ public final class HashMapBackedSessionMappingStorage implements SessionMappingS
|
|||
ID_TO_SESSION_KEY_MAPPING.remove(sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized HttpSession removeSessionByMappingId(String mappingId) {
|
||||
final HttpSession session = MANAGED_SESSIONS.get(mappingId);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
|
|||
|
||||
private final AtomicBoolean handlerInitialized = new AtomicBoolean(false);
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
super.init(filterConfig);
|
||||
if (!isIgnoreInitConfiguration()) {
|
||||
|
|
@ -75,8 +76,9 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
|
|||
HANDLER.setSessionMappingStorage(storage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
final HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
|
||||
|
|
@ -93,6 +95,7 @@ public final class SingleSignOutFilter extends AbstractConfigurationFilter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ public final class SingleSignOutHandler {
|
|||
|
||||
private class Servlet25LogoutStrategy implements LogoutStrategy {
|
||||
|
||||
@Override
|
||||
public void logout(final HttpServletRequest request) {
|
||||
// nothing additional to do here
|
||||
}
|
||||
|
|
@ -320,6 +321,7 @@ public final class SingleSignOutHandler {
|
|||
|
||||
private class Servlet30LogoutStrategy implements LogoutStrategy {
|
||||
|
||||
@Override
|
||||
public void logout(final HttpServletRequest request) {
|
||||
try {
|
||||
request.logout();
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ public final class SingleSignOutHttpSessionListener implements HttpSessionListen
|
|||
|
||||
private SessionMappingStorage sessionMappingStorage;
|
||||
|
||||
@Override
|
||||
public void sessionCreated(final HttpSessionEvent event) {
|
||||
// nothing to do at the moment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionDestroyed(final HttpSessionEvent event) {
|
||||
if (sessionMappingStorage == null) {
|
||||
sessionMappingStorage = getSessionMappingStorage();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import javax.net.ssl.SSLSession;
|
|||
public final class AnyHostnameVerifier implements HostnameVerifier {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean verify(final String hostname, final SSLSession session) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ public final class HttpsURLConnectionFactory implements HttpURLConnectionFactory
|
|||
this.hostnameVerifier = verifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpURLConnection buildHttpURLConnection(final URLConnection url) {
|
||||
return this.configureHttpsConnectionIfNeeded(url);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public final class RegexHostnameVerifier implements HostnameVerifier, Serializab
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean verify(final String hostname, final SSLSession session) {
|
||||
return pattern.matcher(hostname).matches();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public final class WhitelistHostnameVerifier implements HostnameVerifier, Serial
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean verify(final String hostname, final SSLSession session) {
|
||||
|
||||
for (final String allowedHost : this.allowedHosts) {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
|
|||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void init(final FilterConfig filterConfig) throws ServletException {
|
||||
super.init(filterConfig);
|
||||
if (!isIgnoreInitConfiguration()) {
|
||||
|
|
@ -97,6 +98,7 @@ public abstract class AbstractCasFilter extends AbstractConfigurationFilter {
|
|||
}
|
||||
|
||||
// empty implementation as most filters won't need this.
|
||||
@Override
|
||||
public void destroy() {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public abstract class AbstractConfigurationFilter implements Filter {
|
|||
|
||||
private ConfigurationStrategy configurationStrategy;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
final String configurationStrategyName = filterConfig.getServletContext().getInitParameter(CONFIGURATION_STRATEGY_KEY);
|
||||
this.configurationStrategy = ReflectUtils.newInstance(ConfigurationStrategyName.resolveToConfigurationStrategy(configurationStrategyName));
|
||||
|
|
|
|||
|
|
@ -32,12 +32,14 @@ import org.jasig.cas.client.validation.Assertion;
|
|||
*/
|
||||
public final class AssertionThreadLocalFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
final HttpSession session = request.getSession(false);
|
||||
final Assertion assertion = (Assertion) (session == null ? request
|
||||
|
|
@ -52,6 +54,7 @@ public final class AssertionThreadLocalFilter implements Filter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,10 +77,12 @@ public final class DelegatingFilter implements Filter {
|
|||
this.exactMatch = exactMatch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
|
|
@ -107,6 +109,7 @@ public final class DelegatingFilter implements Filter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
// nothing to do here.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,12 @@ public final class ErrorRedirectFilter implements Filter {
|
|||
|
||||
private String defaultErrorRedirectPage;
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
final HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||
|
|
@ -94,6 +96,7 @@ public final class ErrorRedirectFilter implements Filter {
|
|||
return throwable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
this.defaultErrorRedirectPage = filterConfig.getInitParameter("defaultErrorRedirectPage");
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public final class HttpServletRequestWrapperFilter extends AbstractConfiguration
|
|||
/** Whether or not to ignore case in role membership queries */
|
||||
private boolean ignoreCase;
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
@ -63,8 +64,9 @@ public final class HttpServletRequestWrapperFilter extends AbstractConfiguration
|
|||
* <code>request.getRemoteUser</code> to the underlying Assertion object
|
||||
* stored in the user session.
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final AttributePrincipal principal = retrievePrincipalFromSessionOrRequest(servletRequest);
|
||||
|
||||
filterChain.doFilter(new CasHttpServletRequestWrapper((HttpServletRequest) servletRequest, principal),
|
||||
|
|
@ -81,6 +83,7 @@ public final class HttpServletRequestWrapperFilter extends AbstractConfiguration
|
|||
return assertion == null ? null : assertion.getPrincipal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
super.init(filterConfig);
|
||||
this.roleAttribute = getString(ConfigurationKeys.ROLE_ATTRIBUTE);
|
||||
|
|
@ -96,14 +99,17 @@ public final class HttpServletRequestWrapperFilter extends AbstractConfiguration
|
|||
this.principal = principal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Principal getUserPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteUser() {
|
||||
return principal != null ? this.principal.getName() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUserInRole(final String role) {
|
||||
if (CommonUtils.isBlank(role)) {
|
||||
logger.debug("No valid role provided. Returning false.");
|
||||
|
|
|
|||
|
|
@ -61,10 +61,12 @@ public class MapNamespaceContext implements NamespaceContext {
|
|||
this.namespaceMap = namespaceMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI(final String prefix) {
|
||||
return namespaceMap.get(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final String namespaceURI) {
|
||||
for (final Map.Entry<String, String> entry : namespaceMap.entrySet()) {
|
||||
if (entry.getValue().equalsIgnoreCase(namespaceURI)) {
|
||||
|
|
@ -74,6 +76,7 @@ public class MapNamespaceContext implements NamespaceContext {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getPrefixes(final String namespaceURI) {
|
||||
return Collections.singleton(getPrefix(namespaceURI)).iterator();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,18 +50,22 @@ public class ThreadLocalXPathExpression extends ThreadLocal<XPathExpression> imp
|
|||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object evaluate(final Object o, final QName qName) throws XPathExpressionException {
|
||||
return get().evaluate(o, qName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String evaluate(final Object o) throws XPathExpressionException {
|
||||
return get().evaluate(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object evaluate(final InputSource inputSource, final QName qName) throws XPathExpressionException {
|
||||
return get().evaluate(inputSource, qName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String evaluate(final InputSource inputSource) throws XPathExpressionException {
|
||||
return get().evaluate(inputSource);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,13 +118,15 @@ public final class XmlUtils {
|
|||
|
||||
private StringBuilder buffer = new StringBuilder();
|
||||
|
||||
@Override
|
||||
public void startElement(final String uri, final String localName, final String qName,
|
||||
final Attributes attributes) throws SAXException {
|
||||
final Attributes attributes) throws SAXException {
|
||||
if (localName.equals(element)) {
|
||||
this.foundElement = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(final String uri, final String localName, final String qName) throws SAXException {
|
||||
if (localName.equals(element)) {
|
||||
this.foundElement = false;
|
||||
|
|
@ -133,6 +135,7 @@ public final class XmlUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {
|
||||
if (this.foundElement) {
|
||||
this.buffer.append(ch, start, length);
|
||||
|
|
@ -169,19 +172,22 @@ public final class XmlUtils {
|
|||
|
||||
private boolean foundElement = false;
|
||||
|
||||
@Override
|
||||
public void startElement(final String uri, final String localName, final String qName,
|
||||
final Attributes attributes) throws SAXException {
|
||||
final Attributes attributes) throws SAXException {
|
||||
if (localName.equals(element)) {
|
||||
this.foundElement = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(final String uri, final String localName, final String qName) throws SAXException {
|
||||
if (localName.equals(element)) {
|
||||
this.foundElement = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {
|
||||
if (this.foundElement) {
|
||||
builder.append(ch, start, length);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public abstract class AbstractCasProtocolUrlBasedTicketValidator extends Abstrac
|
|||
/**
|
||||
* Retrieves the response from the server by opening a connection and merely reading the response.
|
||||
*/
|
||||
@Override
|
||||
protected final String retrieveResponseFromServer(final URL validationUrl, final String ticket) {
|
||||
return CommonUtils.getResponseFromServer(validationUrl, getURLConnectionFactory(), getEncoding());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
|
||||
setExceptionOnValidationFailure(getBoolean(ConfigurationKeys.EXCEPTION_ON_VALIDATION_FAILURE));
|
||||
setRedirectAfterValidation(getBoolean(ConfigurationKeys.REDIRECT_AFTER_VALIDATION));
|
||||
|
|
@ -141,6 +142,7 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
super.initInternal(filterConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
CommonUtils.assertNotNull(this.ticketValidator, "ticketValidator cannot be null.");
|
||||
|
|
@ -186,8 +188,9 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
// nothing to do here.
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
|
||||
if (!preFilter(servletRequest, servletResponse, filterChain)) {
|
||||
return;
|
||||
|
|
@ -252,4 +255,4 @@ public abstract class AbstractTicketValidationFilter extends AbstractCasFilter {
|
|||
public final void setUseSession(final boolean useSession) {
|
||||
this.useSession = useSession;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ public abstract class AbstractUrlBasedTicketValidator implements TicketValidator
|
|||
|
||||
protected abstract String retrieveResponseFromServer(URL validationUrl, String ticket);
|
||||
|
||||
@Override
|
||||
public final Assertion validate(final String ticket, final String service) throws TicketValidationException {
|
||||
final String validationUrl = constructValidationUrl(ticket, service);
|
||||
logger.debug("Constructing validation url: {}", validationUrl);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class Cas10TicketValidationFilter extends AbstractTicketValidationFilter
|
|||
super(Protocol.CAS1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final TicketValidator getTicketValidator(final FilterConfig filterConfig) {
|
||||
final String casServerUrlPrefix = getString(ConfigurationKeys.CAS_SERVER_URL_PREFIX);
|
||||
final Cas10TicketValidator validator = new Cas10TicketValidator(casServerUrlPrefix);
|
||||
|
|
|
|||
|
|
@ -35,10 +35,12 @@ public final class Cas10TicketValidator extends AbstractCasProtocolUrlBasedTicke
|
|||
super(casServerUrlPrefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUrlSuffix() {
|
||||
return "validate";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Assertion parseResponseFromServer(final String response) throws TicketValidationException {
|
||||
if (!response.startsWith("yes")) {
|
||||
throw new TicketValidationException("CAS Server could not validate ticket.");
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
|
|||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(final FilterConfig filterConfig) throws ServletException {
|
||||
setProxyReceptorUrl(getString(ConfigurationKeys.PROXY_RECEPTOR_URL));
|
||||
|
||||
|
|
@ -122,6 +123,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
|
|||
super.initInternal(filterConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
CommonUtils.assertNotNull(this.proxyGrantingTicketStorage, "proxyGrantingTicketStorage cannot be null.");
|
||||
|
|
@ -158,6 +160,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
|
|||
* @param filterConfig the Filter Configuration object.
|
||||
* @return a fully constructed TicketValidator.
|
||||
*/
|
||||
@Override
|
||||
protected final TicketValidator getTicketValidator(final FilterConfig filterConfig) {
|
||||
final boolean allowAnyProxy = getBoolean(ConfigurationKeys.ACCEPT_ANY_PROXY);
|
||||
final String allowedProxyChains = getString(ConfigurationKeys.ALLOWED_PROXY_CHAINS);
|
||||
|
|
@ -203,6 +206,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
|
|||
return validator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
this.timer.cancel();
|
||||
|
|
@ -211,6 +215,7 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
|
|||
/**
|
||||
* This processes the ProxyReceptor request before the ticket validation code executes.
|
||||
*/
|
||||
@Override
|
||||
protected final boolean preFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain filterChain) throws IOException, ServletException {
|
||||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class Cas20ProxyTicketValidator extends Cas20ServiceTicketValidator {
|
|||
return this.allowedProxyChains;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUrlSuffix() {
|
||||
return "proxyValidate";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,14 +78,17 @@ public class Cas20ServiceTicketValidator extends AbstractCasProtocolUrlBasedTick
|
|||
*
|
||||
* @param urlParameters the Map containing the existing parameters to send to the server.
|
||||
*/
|
||||
@Override
|
||||
protected final void populateUrlAttributeMap(final Map<String, String> urlParameters) {
|
||||
urlParameters.put("pgtUrl", this.proxyCallbackUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUrlSuffix() {
|
||||
return "serviceValidate";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Assertion parseResponseFromServer(final String response) throws TicketValidationException {
|
||||
final String error = parseAuthenticationFailureFromResponse(response);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import org.jasig.cas.client.util.CommonUtils;
|
|||
*/
|
||||
public final class ProxyListEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(final String text) throws IllegalArgumentException {
|
||||
final BufferedReader reader = new BufferedReader(new StringReader(text));
|
||||
final List<String[]> proxyChains = new ArrayList<String[]>();
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ public final class PublicTestHttpServer extends Thread {
|
|||
httpServer = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
@ -116,6 +117,7 @@ public final class AuthenticationFilterTests {
|
|||
request.setSecure(true);
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
@ -146,6 +148,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
@ -165,6 +168,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
@ -185,6 +189,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
@ -267,6 +272,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
}
|
||||
};
|
||||
|
|
@ -296,6 +302,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
}
|
||||
};
|
||||
|
|
@ -330,6 +337,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
}
|
||||
};
|
||||
|
|
@ -359,6 +367,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
}
|
||||
};
|
||||
|
|
@ -388,6 +397,7 @@ public final class AuthenticationFilterTests {
|
|||
final MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public final class ConfigurationStrategyNameTests {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig, Class<? extends Filter> filterClazz) {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,14 +51,17 @@ public class CleanUpTimerTaskTest extends TestCase {
|
|||
return cleanUpCalled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanUp() {
|
||||
cleanUpCalled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String retrieve(String proxyGrantingTicketIou) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(String proxyGrantingTicketIou, String proxyGrantingTicket) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public final class CasFilterTests {
|
|||
public TestCasFilter() {
|
||||
super(Protocol.CAS2);
|
||||
}
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
|
||||
ServletException {
|
||||
// nothing to do
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ public final class HttpServletRequestWrapperFilterTests extends TestCase {
|
|||
|
||||
private FilterChain createFilterChain() {
|
||||
return new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
HttpServletRequestWrapperFilterTests.this.mockRequest = (HttpServletRequest) request;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public class Cas20ProxyReceivingTicketValidationFilterTests extends TestCase {
|
|||
final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
|
||||
|
||||
final Timer timer = new Timer(true) {
|
||||
@Override
|
||||
public void schedule(TimerTask task, long delay, long period) {
|
||||
scheduleMethodFlag.setCalled();
|
||||
}
|
||||
|
|
@ -66,6 +67,7 @@ public class Cas20ProxyReceivingTicketValidationFilterTests extends TestCase {
|
|||
final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
|
||||
|
||||
final Timer timer = new Timer(true) {
|
||||
@Override
|
||||
public void cancel() {
|
||||
cancelMethodFlag.setCalled();
|
||||
super.cancel();
|
||||
|
|
@ -87,6 +89,7 @@ public class Cas20ProxyReceivingTicketValidationFilterTests extends TestCase {
|
|||
final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
|
||||
|
||||
final TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
timerTaskFlag.setCalled();
|
||||
}
|
||||
|
|
@ -112,6 +115,7 @@ public class Cas20ProxyReceivingTicketValidationFilterTests extends TestCase {
|
|||
final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
|
||||
|
||||
final TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
timerTaskFlag.setCalled();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public final class Cas20ProxyTicketValidatorTests extends AbstractTicketValidato
|
|||
/** Unique Id For serialization. */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getProxyTicketIdFor(String proxyGrantingTicketId, String targetService) {
|
||||
return "test";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public final class Cas20ServiceTicketValidatorTests extends AbstractTicketValida
|
|||
/** Unique Id for serialization. */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getProxyTicketIdFor(String proxyGrantingTicketId, String targetService) {
|
||||
return "test";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public final class Cas30ServiceTicketValidatorTests extends AbstractTicketValida
|
|||
/** Unique Id for serialization. */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getProxyTicketIdFor(String proxyGrantingTicketId, String targetService) {
|
||||
return "test";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public class Cas30JsonServiceTicketValidatorTests extends AbstractTicketValidato
|
|||
/** Unique Id for serialization. */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getProxyTicketIdFor(final String proxyGrantingTicketId, final String targetService) {
|
||||
return "test";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,9 @@ public final class WebAuthenticationFilter extends AbstractCasFilter {
|
|||
super(Protocol.CAS2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
|
||||
final FilterChain chain) throws IOException, ServletException {
|
||||
final FilterChain chain) throws IOException, ServletException {
|
||||
final HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
final HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
final HttpSession session = request.getSession();
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public abstract class AbstractLogoutHandler implements LogoutHandler {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void logout(final HttpServletRequest request, final HttpServletResponse response) {
|
||||
logger.debug("Processing logout request from CAS server.");
|
||||
|
||||
|
|
|
|||
|
|
@ -54,11 +54,13 @@ public class AssertionCasRealmDelegate implements CasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Principal authenticate(final Principal p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String[] getRoles(final Principal p) {
|
||||
CommonUtils.assertTrue(p instanceof AttributePrincipal,
|
||||
"Expected instance of AttributePrincipal but got " + p.getClass());
|
||||
|
|
@ -70,6 +72,7 @@ public class AssertionCasRealmDelegate implements CasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean hasRole(final Principal principal, final String role) {
|
||||
if ("*".equals(role)) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public class PropertiesCasRealmDelegate implements CasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Principal authenticate(final Principal p) {
|
||||
if (this.roleMap.containsKey(p.getName())) {
|
||||
return p;
|
||||
|
|
@ -100,12 +101,14 @@ public class PropertiesCasRealmDelegate implements CasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String[] getRoles(final Principal p) {
|
||||
final Set<String> roleSet = this.roleMap.get(p.getName());
|
||||
return roleSet.toArray(new String[roleSet.size()]);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean hasRole(final Principal principal, final String role) {
|
||||
if ("*".equals(role)) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public final class RegexUriLogoutHandler extends AbstractLogoutHandler {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isLogoutRequest(final HttpServletRequest request) {
|
||||
return this.logoutUriPattern.matcher(request.getRequestURI()).matches();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public final class StaticUriLogoutHandler extends AbstractLogoutHandler {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isLogoutRequest(final HttpServletRequest request) {
|
||||
return this.logoutUri.equals(request.getRequestURI());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ public class PropertiesCasRealmDelegateTests extends TestCase {
|
|||
private final PropertiesCasRealmDelegate realm = new PropertiesCasRealmDelegate();
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
realm.setPropertiesFilePath("src/test/resources/org/jasig/cas/client/tomcat/user-roles.properties");
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
*/
|
||||
protected abstract TicketValidator getTicketValidator();
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
logger.debug("{} starting.", getName());
|
||||
|
|
@ -144,6 +145,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean authenticate(final Request request, final Response response, final LoginConfig loginConfig)
|
||||
throws IOException {
|
||||
Principal principal = request.getUserPrincipal();
|
||||
|
|
@ -162,6 +164,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void lifecycleEvent(final LifecycleEvent event) {
|
||||
if (AFTER_START_EVENT.equals(event.getType())) {
|
||||
logger.debug("{} processing lifecycle event {}", getName(), AFTER_START_EVENT);
|
||||
|
|
@ -172,6 +175,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getInfo() {
|
||||
return getName() + "/1.0";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ public abstract class AbstractCasAuthenticator extends AbstractAuthenticator {
|
|||
this.proxyCallbackUrl = proxyCallbackUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final String getArtifactParameterName() {
|
||||
return "ticket";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final String getServiceParameterName() {
|
||||
return "service";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,16 +37,19 @@ public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
|
|||
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Principal authenticate(final Principal p) {
|
||||
return getDelegate().authenticate(p);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String[] getRoles(final Principal p) {
|
||||
return getDelegate().getRoles(p);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean hasRole(final Principal principal, final String role) {
|
||||
return getDelegate().hasRole(principal, role);
|
||||
}
|
||||
|
|
@ -57,21 +60,25 @@ public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getInfo() {
|
||||
return getClass().getName() + "/1.0";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getPassword(final String username) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected Principal getPrincipal(final String username) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,26 +43,31 @@ public abstract class AbstractLifecycleValve extends ValveBase implements Lifecy
|
|||
private final LifecycleSupport lifecycle = new LifecycleSupport(this);
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void addLifecycleListener(final LifecycleListener listener) {
|
||||
lifecycle.addLifecycleListener(listener);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public LifecycleListener[] findLifecycleListeners() {
|
||||
return lifecycle.findLifecycleListeners();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void removeLifecycleListener(final LifecycleListener listener) {
|
||||
lifecycle.removeLifecycleListener(listener);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
logger.debug("{} starting.", getName());
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void stop() throws LifecycleException {
|
||||
logger.debug("{} stopping.", getName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.jasig.cas.client.tomcat.LogoutHandler;
|
|||
* @since 3.1.12
|
||||
*/
|
||||
public abstract class AbstractLogoutValve extends AbstractLifecycleValve {
|
||||
@Override
|
||||
public final void invoke(final Request request, final Response response) throws IOException, ServletException {
|
||||
if (getLogoutHandler().isLogoutRequest(request)) {
|
||||
getLogoutHandler().logout(request, response);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public class AssertionCasRealm extends AbstractCasRealm {
|
|||
private final AssertionCasRealmDelegate delegate = new AssertionCasRealmDelegate();
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
logger.info("Startup completed.");
|
||||
|
|
@ -50,6 +51,7 @@ public class AssertionCasRealm extends AbstractCasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected CasRealm getDelegate() {
|
||||
return this.delegate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,18 +37,22 @@ public class Cas10CasAuthenticator extends AbstractCasAuthenticator {
|
|||
|
||||
private Cas10TicketValidator ticketValidator;
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.ticketValidator = new Cas10TicketValidator(getCasServerUrlPrefix());
|
||||
|
|
|
|||
|
|
@ -37,18 +37,22 @@ public final class Cas20CasAuthenticator extends AbstractCasAuthenticator {
|
|||
|
||||
private Cas20ServiceTicketValidator ticketValidator;
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.ticketValidator = new Cas20ServiceTicketValidator(getCasServerUrlPrefix());
|
||||
|
|
|
|||
|
|
@ -50,18 +50,22 @@ public final class Cas20ProxyCasAuthenticator extends AbstractCasAuthenticator {
|
|||
this.allowedProxyChains = allowedProxyChains;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.ticketValidator = new Cas20ProxyTicketValidator(getCasServerUrlPrefix());
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class PropertiesCasRealm extends AbstractCasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.delegate.readProperties();
|
||||
|
|
@ -57,6 +58,7 @@ public class PropertiesCasRealm extends AbstractCasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected CasRealm getDelegate() {
|
||||
return this.delegate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public final class ProxyCallbackValve extends AbstractLifecycleValve {
|
|||
this.proxyCallbackUrl = proxyCallbackUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
|
||||
|
|
@ -74,6 +75,7 @@ public final class ProxyCallbackValve extends AbstractLifecycleValve {
|
|||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(final Request request, final Response response) throws IOException, ServletException {
|
||||
if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
|
||||
logger.debug("Processing proxy callback request.");
|
||||
|
|
@ -85,6 +87,7 @@ public final class ProxyCallbackValve extends AbstractLifecycleValve {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public final class RegexUriLogoutValve extends AbstractLogoutValve {
|
|||
this.logoutHandler.setLogoutUriRegex(regex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.logoutHandler.init();
|
||||
|
|
@ -51,11 +52,13 @@ public final class RegexUriLogoutValve extends AbstractLogoutValve {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected LogoutHandler getLogoutHandler() {
|
||||
return this.logoutHandler;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public class Saml11Authenticator extends AbstractAuthenticator {
|
|||
this.tolerance = ms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.ticketValidator = new Saml11TicketValidator(getCasServerUrlPrefix());
|
||||
|
|
@ -62,24 +63,29 @@ public class Saml11Authenticator extends AbstractAuthenticator {
|
|||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getArtifactParameterName() {
|
||||
return "SAMLart";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getServiceParameterName() {
|
||||
return "TARGET";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.handler.init();
|
||||
|
|
@ -72,6 +73,7 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void invoke(final Request request, final Response response) throws IOException, ServletException {
|
||||
if (this.handler.process(request, response)) {
|
||||
getNext().invoke(request, response);
|
||||
|
|
@ -79,6 +81,7 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void sessionEvent(final SessionEvent event) {
|
||||
if (Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
|
||||
logger.debug("Cleaning up SessionMappingStorage on destroySession event");
|
||||
|
|
@ -87,6 +90,7 @@ public class SingleSignOutValve extends AbstractLifecycleValve implements Sessio
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public final class StaticUriLogoutValve extends AbstractLogoutValve {
|
|||
this.logoutHandler.setLogoutUri(logoutUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws LifecycleException {
|
||||
super.start();
|
||||
this.logoutHandler.init();
|
||||
|
|
@ -51,11 +52,13 @@ public final class StaticUriLogoutValve extends AbstractLogoutValve {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected LogoutHandler getLogoutHandler() {
|
||||
return this.logoutHandler;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
*
|
||||
* @return the authentication method.
|
||||
*/
|
||||
@Override
|
||||
protected String getAuthMethod() {
|
||||
return getAuthenticationMethod();
|
||||
}
|
||||
|
|
@ -86,6 +87,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
*/
|
||||
protected abstract TicketValidator getTicketValidator();
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
logger.debug("{} starting.", getName());
|
||||
|
|
@ -150,8 +152,9 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean authenticate(final Request request, final HttpServletResponse response,
|
||||
final LoginConfig loginConfig) throws IOException {
|
||||
final LoginConfig loginConfig) throws IOException {
|
||||
Principal principal = request.getUserPrincipal();
|
||||
boolean result = false;
|
||||
if (principal == null) {
|
||||
|
|
@ -168,6 +171,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void lifecycleEvent(final LifecycleEvent event) {
|
||||
if (AFTER_START_EVENT.equals(event.getType())) {
|
||||
logger.debug("{} processing lifecycle event {}", getName(), AFTER_START_EVENT);
|
||||
|
|
@ -178,12 +182,14 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getInfo() {
|
||||
return getName() + "/1.0";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected synchronized void setState(LifecycleState state, Object data) {
|
||||
@Override
|
||||
protected synchronized void setState(LifecycleState state, Object data) throws LifecycleException {
|
||||
super.setState(state, data);
|
||||
if (LifecycleState.STARTED.equals(state)) {
|
||||
logger.info("{} started.", getName());
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ public abstract class AbstractCasAuthenticator extends AbstractAuthenticator {
|
|||
this.proxyCallbackUrl = proxyCallbackUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final String getArtifactParameterName() {
|
||||
return "ticket";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final String getServiceParameterName() {
|
||||
return "service";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,15 +33,18 @@ import org.jasig.cas.client.tomcat.CasRealm;
|
|||
public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Principal authenticate(final Principal p) {
|
||||
return getDelegate().authenticate(p);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String[] getRoles(final Principal p) {
|
||||
return getDelegate().getRoles(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRole(final Principal principal, final String role) {
|
||||
return getDelegate().hasRole(principal, role);
|
||||
}
|
||||
|
|
@ -49,6 +52,7 @@ public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
|
|||
/**
|
||||
* Tomcat 7.0.8 changed their APIs so {@link #hasRole(java.security.Principal, String)} is only valid for 7.0.7 and below.
|
||||
*/
|
||||
@Override
|
||||
public boolean hasRole(final Wrapper wrapper, final Principal principal, final String role) {
|
||||
return hasRole(principal, role);
|
||||
}
|
||||
|
|
@ -59,21 +63,25 @@ public abstract class AbstractCasRealm extends RealmBase implements CasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public String getInfo() {
|
||||
return getClass().getName() + "/1.0";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getPassword(final String userName) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected Principal getPrincipal(final String userName) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public abstract class AbstractLogoutValve extends ValveBase {
|
|||
|
||||
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public final void invoke(final Request request, final Response response) throws IOException, ServletException {
|
||||
if (getLogoutHandler().isLogoutRequest(request)) {
|
||||
getLogoutHandler().logout(request, response);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ public class AssertionCasRealm extends AbstractCasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected CasRealm getDelegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,18 +37,22 @@ public final class Cas10CasAuthenticator extends AbstractCasAuthenticator {
|
|||
|
||||
private Cas10TicketValidator ticketValidator;
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.ticketValidator = new Cas10TicketValidator(getCasServerUrlPrefix());
|
||||
|
|
|
|||
|
|
@ -37,18 +37,22 @@ public final class Cas20CasAuthenticator extends AbstractCasAuthenticator {
|
|||
|
||||
private Cas20ServiceTicketValidator ticketValidator;
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.ticketValidator = new Cas20ServiceTicketValidator(getCasServerUrlPrefix());
|
||||
|
|
|
|||
|
|
@ -50,18 +50,22 @@ public final class Cas20ProxyCasAuthenticator extends AbstractCasAuthenticator {
|
|||
this.allowedProxyChains = allowedProxyChains;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.ticketValidator = new Cas20ProxyTicketValidator(getCasServerUrlPrefix());
|
||||
|
|
|
|||
|
|
@ -50,12 +50,14 @@ public class PropertiesCasRealm extends AbstractCasRealm {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.delegate.readProperties();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected CasRealm getDelegate() {
|
||||
return this.delegate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public final class ProxyCallbackValve extends ValveBase {
|
|||
this.proxyCallbackUrl = proxyCallbackUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
|
||||
|
|
@ -78,6 +79,7 @@ public final class ProxyCallbackValve extends ValveBase {
|
|||
logger.info("Startup completed.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(final Request request, final Response response) throws IOException, ServletException {
|
||||
if (this.proxyCallbackUrl.equals(request.getRequestURI())) {
|
||||
logger.debug("Processing proxy callback request.");
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public final class RegexUriLogoutValve extends AbstractLogoutValve {
|
|||
this.logoutHandler.setLogoutUriRegex(regex);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.logoutHandler.init();
|
||||
|
|
@ -49,6 +50,7 @@ public final class RegexUriLogoutValve extends AbstractLogoutValve {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected LogoutHandler getLogoutHandler() {
|
||||
return this.logoutHandler;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public final class Saml11Authenticator extends AbstractAuthenticator {
|
|||
this.tolerance = ms;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.ticketValidator = new Saml11TicketValidator(getCasServerUrlPrefix());
|
||||
|
|
@ -60,24 +61,29 @@ public final class Saml11Authenticator extends AbstractAuthenticator {
|
|||
this.ticketValidator.setRenew(isRenew());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TicketValidator getTicketValidator() {
|
||||
return this.ticketValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAuthenticationMethod() {
|
||||
return AUTH_METHOD;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getArtifactParameterName() {
|
||||
return "SAMLart";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected String getServiceParameterName() {
|
||||
return "TARGET";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public class SingleSignOutValve extends ValveBase implements SessionListener {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void invoke(final Request request, final Response response) throws IOException, ServletException {
|
||||
if (this.handler.process(request, response)) {
|
||||
getNext().invoke(request, response);
|
||||
|
|
@ -76,6 +77,7 @@ public class SingleSignOutValve extends ValveBase implements SessionListener {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void sessionEvent(final SessionEvent event) {
|
||||
if (Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
|
||||
logger.debug("Cleaning up SessionMappingStorage on destroySession event");
|
||||
|
|
@ -84,6 +86,7 @@ public class SingleSignOutValve extends ValveBase implements SessionListener {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
logger.info("Starting...");
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public final class StaticUriLogoutValve extends AbstractLogoutValve {
|
|||
this.logoutHandler.setLogoutUri(logoutUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
this.logoutHandler.init();
|
||||
|
|
@ -49,6 +50,7 @@ public final class StaticUriLogoutValve extends AbstractLogoutValve {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected LogoutHandler getLogoutHandler() {
|
||||
return this.logoutHandler;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@ import java.security.Principal;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.catalina.*;
|
||||
import org.apache.catalina.LifecycleEvent;
|
||||
import org.apache.catalina.LifecycleException;
|
||||
import org.apache.catalina.LifecycleListener;
|
||||
import org.apache.catalina.LifecycleState;
|
||||
import org.apache.catalina.Realm;
|
||||
import org.apache.catalina.authenticator.AuthenticatorBase;
|
||||
import org.apache.catalina.connector.Request;
|
||||
import org.jasig.cas.client.tomcat.AuthenticatorDelegate;
|
||||
|
|
@ -61,6 +65,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
*
|
||||
* @return the authentication method.
|
||||
*/
|
||||
@Override
|
||||
protected String getAuthMethod() {
|
||||
return getAuthenticationMethod();
|
||||
}
|
||||
|
|
@ -87,10 +92,11 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
*/
|
||||
protected abstract TicketValidator getTicketValidator();
|
||||
|
||||
@Override
|
||||
protected void startInternal() throws LifecycleException {
|
||||
super.startInternal();
|
||||
logger.debug("{} starting.", getName());
|
||||
final Realm realm = this.context.getRealm();
|
||||
final Realm realm = getContainer().getRealm();
|
||||
try {
|
||||
CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getClass());
|
||||
CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null.");
|
||||
|
|
@ -151,7 +157,8 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public final boolean authenticate(final Request request, final HttpServletResponse response) throws IOException {
|
||||
@Override
|
||||
public final boolean doAuthenticate(final Request request, final HttpServletResponse response) throws IOException {
|
||||
Principal principal = request.getUserPrincipal();
|
||||
boolean result = false;
|
||||
if (principal == null) {
|
||||
|
|
@ -168,6 +175,7 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void lifecycleEvent(final LifecycleEvent event) {
|
||||
if (AFTER_START_EVENT.equals(event.getType())) {
|
||||
logger.debug("{} processing lifecycle event {}", getName(), AFTER_START_EVENT);
|
||||
|
|
@ -184,7 +192,8 @@ public abstract class AbstractAuthenticator extends AuthenticatorBase implements
|
|||
|
||||
/** {@inheritDoc}
|
||||
* @throws LifecycleException */
|
||||
protected synchronized void setState(LifecycleState state, Object data) throws LifecycleException {
|
||||
@Override
|
||||
protected synchronized void setState(final LifecycleState state, final Object data) throws LifecycleException {
|
||||
super.setState(state, data);
|
||||
if (LifecycleState.STARTED.equals(state)) {
|
||||
logger.info("{} started.", getName());
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ public abstract class AbstractCasAuthenticator extends AbstractAuthenticator {
|
|||
this.proxyCallbackUrl = proxyCallbackUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final String getArtifactParameterName() {
|
||||
return "ticket";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final String getServiceParameterName() {
|
||||
return "service";
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue