Commit 0ea8ab05 authored by Misagh Moayyed's avatar Misagh Moayyed
Browse files

removed deprecated config

parent fe7e5831
......@@ -580,17 +580,6 @@ public final class CentralAuthenticationServiceImpl implements CentralAuthentica
this.serviceTicketExpirationPolicy = serviceTicketExpirationPolicy;
}
/**
* @deprecated
* Sets persistent id generator.
*
* @param persistentIdGenerator the persistent id generator
*/
@Deprecated
public void setPersistentIdGenerator(final PersistentIdGenerator persistentIdGenerator) {
logger.warn("setPersistentIdGenerator() is deprecated and no longer available. Consider "
+ "configuring the an attribute provider for service definitions.");
}
/**
* Sets principal factory to create principal objects.
......
......@@ -52,19 +52,6 @@ public final class TicketOrCredentialPrincipalResolver implements PrincipalResol
@NotNull
private final CentralAuthenticationService centralAuthenticationService;
/**
* Instantiates a new ticket or credential principal resolver.
*
* @deprecated As of 4.1 access to the registry is no longer relevant
* Consider using alternative constructors instead.
* @param ticketRegistry the ticket registry
*/
@Deprecated
public TicketOrCredentialPrincipalResolver(final TicketRegistry ticketRegistry) {
LOGGER.warn("The constructor is deprecated and will be removed. Consider an alternate constructor");
this.centralAuthenticationService = null;
}
/**
* Instantiates a new Ticket or credential principal resolver.
*
......
......@@ -90,15 +90,4 @@ public final class HttpBasedServiceCredentialsAuthenticationHandler extends Abst
this.httpClient = httpClient;
}
/**
* @deprecated As of 4.1. Endpoint security is handled by service proxy policies
*
* <p>Set whether a secure url is required or not.</p>
*
* @param requireSecure true if its required, false if not. Default is true.
*/
@Deprecated
public void setRequireSecure(final boolean requireSecure) {
logger.warn("setRequireSecure() is deprecated and will be removed. Callback url validation is controlled by the proxy policy");
}
}
......@@ -70,19 +70,6 @@ public final class ShibbolethCompatiblePersistentIdGenerator implements Persiste
this.salt = salt.getBytes(Charset.defaultCharset());
}
/**
* @deprecated As of 4.1.
* Sets salt.
*
* @param salt the salt
*/
@Deprecated
public void setSalt(final String salt) {
this.salt = salt.getBytes(Charset.defaultCharset());
LOGGER.warn("setSalt() is deprecated and will be removed. Use the constructor instead.");
}
/**
* Get salt.
*
......
......@@ -98,18 +98,7 @@ public final class LogoutManagerImpl implements LogoutManager {
this.asynchronous = asyncCallbacks;
}
/**
* Set if messages are sent in an asynchronous fashion.
*
* @param asyncCallbacks if message is synchronously sent
* @deprecated As of 4.1. Use {@link #setAsynchronous(boolean)} instead
*/
@Deprecated
public void setIssueAsynchronousCallbacks(final boolean asyncCallbacks) {
this.asynchronous = asyncCallbacks;
LOGGER.warn("setIssueAsynchronousCallbacks() is deprecated. Use setAsynchronous() instead.");
}
/**
* Perform a back channel logout for a given ticket granting ticket and returns all the logout requests.
*
......
/*
* Licensed to Apereo under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Apereo licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jasig.cas.remoting.server;
import org.apache.commons.collections4.Predicate;
import org.jasig.cas.CentralAuthenticationService;
import org.jasig.cas.authentication.AuthenticationException;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.logout.LogoutRequest;
import org.jasig.cas.ticket.AbstractTicketException;
import org.jasig.cas.ticket.InvalidTicketException;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.ticket.Ticket;
import org.jasig.cas.ticket.TicketGrantingTicket;
import org.jasig.cas.validation.Assertion;
import org.springframework.util.Assert;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* Wrapper implementation around a CentralAuthenticationService that
* completes the marshalling of parameters from the web-service layer to the
* service layer. Typically the only thing that is done is to validate the
* parameters (as you would in the web tier) and then delegate to the service
* layer.
* <p>
* The following properties are required:
* </p>
* <ul>
* <li>centralAuthenticationService - the service layer we are delegating to.</li>
* </ul>
*
* @author Scott Battaglia
@deprecated As of 4.1. No longer required. The default implementation can be used
to delegate calls to the service layer from WS.
* @since 3.0.0
*/
@Deprecated
public final class RemoteCentralAuthenticationService implements CentralAuthenticationService {
/** The CORE to delegate to. */
@NotNull
private CentralAuthenticationService centralAuthenticationService;
/** The validators to check the Credential. */
@NotNull
private Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
/**
* {@inheritDoc}
* @throws IllegalArgumentException if the Credentials are null or if given
* invalid credentials.
*/
@Override
public TicketGrantingTicket createTicketGrantingTicket(final Credential... credentials)
throws AuthenticationException, AbstractTicketException {
Assert.notNull(credentials, "credentials cannot be null");
checkForErrors(credentials);
return this.centralAuthenticationService.createTicketGrantingTicket(credentials);
}
/**
* {@inheritDoc}
*/
@Override
public ServiceTicket grantServiceTicket(final String ticketGrantingTicketId, final Service service)
throws AbstractTicketException {
return this.centralAuthenticationService.grantServiceTicket(ticketGrantingTicketId, service);
}
/**
* {@inheritDoc}
*/
@Override
public Collection<Ticket> getTickets(@NotNull final Predicate predicate) {
return this.centralAuthenticationService.getTickets(predicate);
}
/**
* {@inheritDoc}
* @throws IllegalArgumentException if given invalid credentials
*/
@Override
public ServiceTicket grantServiceTicket(
final String ticketGrantingTicketId, final Service service, final Credential... credentials)
throws AuthenticationException, AbstractTicketException {
checkForErrors(credentials);
return this.centralAuthenticationService.grantServiceTicket(ticketGrantingTicketId, service, credentials);
}
/**
* {@inheritDoc}
*/
@Override
public <T extends Ticket> T getTicket(final String ticketId, final Class<? extends Ticket> clazz)
throws InvalidTicketException {
return this.centralAuthenticationService.getTicket(ticketId, clazz);
}
/**
* {@inheritDoc}
*/
@Override
public Assertion validateServiceTicket(final String serviceTicketId, final Service service) throws AbstractTicketException {
return this.centralAuthenticationService.validateServiceTicket(serviceTicketId, service);
}
/**
* {@inheritDoc}
* <p>Destroy a TicketGrantingTicket and perform back channel logout. This has the effect of invalidating any
* Ticket that was derived from the TicketGrantingTicket being destroyed. May throw an
* {@link IllegalArgumentException} if the TicketGrantingTicket ID is null.
*
* @param ticketGrantingTicketId the id of the ticket we want to destroy
* @return the logout requests.
*/
@Override
public List<LogoutRequest> destroyTicketGrantingTicket(final String ticketGrantingTicketId) {
return this.centralAuthenticationService.destroyTicketGrantingTicket(ticketGrantingTicketId);
}
/**
* {@inheritDoc}
* @throws IllegalArgumentException if the credentials are invalid.
*/
@Override
public TicketGrantingTicket delegateTicketGrantingTicket(final String serviceTicketId, final Credential... credentials)
throws AuthenticationException, AbstractTicketException {
checkForErrors(credentials);
return this.centralAuthenticationService.delegateTicketGrantingTicket(serviceTicketId, credentials);
}
/**
* Check for errors by asking the validator to review each credential.
*
* @param credentials the credentials
*/
private void checkForErrors(final Credential... credentials) {
if (credentials == null) {
return;
}
for (final Credential c : credentials) {
final Set<ConstraintViolation<Credential>> errors = this.validator.validate(c);
if (!errors.isEmpty()) {
throw new IllegalArgumentException("Error validating credentials: " + errors.toString());
}
}
}
/**
* Set the CentralAuthenticationService.
*
* @param centralAuthenticationService The CentralAuthenticationService to
* set.
*/
public void setCentralAuthenticationService(
final CentralAuthenticationService centralAuthenticationService) {
this.centralAuthenticationService = centralAuthenticationService;
}
/**
* Set the list of validators.
*
* @param validator The array of validators to use.
*/
public void setValidator(final Validator validator) {
this.validator = validator;
}
}
......@@ -61,26 +61,6 @@ public final class DefaultServicesManagerImpl implements ReloadableServicesManag
load();
}
/**
* Constructs an instance of the {@link DefaultServicesManagerImpl} where the default RegisteredService
* can include a set of default attributes to use if no services are defined in the registry.
*
* @deprecated
* <p>As of 4.1. Use {@link #DefaultServicesManagerImpl(ServiceRegistryDao)}
* instead. The <code>defaultAttributes</code> parameter is no longer used. Attributes are configured
* per service definition in the services registry. See {@link RegisteredService#getAttributeReleasePolicy()}
* for more details.</p>
*
* @param serviceRegistryDao the Service Registry Dao.
* @param defaultAttributes the list of default attributes to use.
*/
@Deprecated
public DefaultServicesManagerImpl(final ServiceRegistryDao serviceRegistryDao,
final List<String> defaultAttributes) {
this(serviceRegistryDao);
LOGGER.warn("This constructor is deprecated and will be removed in future CAS versions");
}
@Transactional(readOnly = false)
@Audit(action = "DELETE_SERVICE", actionResolverName = "DELETE_SERVICE_ACTION_RESOLVER",
resourceResolverName = "DELETE_SERVICE_RESOURCE_RESOLVER")
......
......@@ -135,16 +135,6 @@ public final class DefaultTicketRegistryCleaner implements RegistryCleaner {
}
}
/**
* @param ticketRegistry The ticketRegistry to set.
* @deprecated As of 4.1. Consider using constructors instead.
*/
@Deprecated
public void setTicketRegistry(final TicketRegistry ticketRegistry) {
logger.warn("Invoking setTicketRegistry() is deprecated and has no impact.");
}
/**
* @param strategy Ticket cleanup locking strategy. An exclusive locking
* strategy is preferable if not required for some ticket backing stores,
......@@ -156,23 +146,4 @@ public final class DefaultTicketRegistryCleaner implements RegistryCleaner {
this.lock = strategy;
}
/**
* @deprecated As of 4.1, single signout callbacks are entirely controlled by the {@link LogoutManager}.
* @param logUserOutOfServices whether to logger the user out of services or not.
*/
@Deprecated
public void setLogUserOutOfServices(final boolean logUserOutOfServices) {
logger.warn("Invoking setLogUserOutOfServices() is deprecated and has no impact.");
}
/**
* Set the logout manager.
*
* @param logoutManager the logout manager.
* @deprecated As of 4.1. Consider using constructors instead.
*/
@Deprecated
public void setLogoutManager(final LogoutManager logoutManager) {
logger.warn("Invoking setLogoutManager() is deprecated and has no impact.");
}
}
......@@ -37,20 +37,10 @@ public final class TicketGrantingTicketExpirationPolicy extends AbstractCasExpir
private static final long serialVersionUID = 7670537200691354820L;
/** Maximum time this ticket is valid. */
private long maxTimeToLiveInMilliSeconds;
private final long maxTimeToLiveInMilliSeconds;
/** Time to kill in milliseconds. */
private long timeToKillInMilliSeconds;
/**
* @deprecated As of 4.1.
* Instantiates a new Ticket granting ticket expiration policy.
*/
@Deprecated
public TicketGrantingTicketExpirationPolicy() {
this.maxTimeToLiveInMilliSeconds = 0;
this.timeToKillInMilliSeconds = 0;
}
private final long timeToKillInMilliSeconds;
/**
* Instantiates a new Ticket granting ticket expiration policy.
......@@ -64,51 +54,6 @@ public final class TicketGrantingTicketExpirationPolicy extends AbstractCasExpir
this.timeToKillInMilliSeconds = timeUnit.toMillis(timeToKill);
}
/**
* @deprecated As of 4.1.
* Set max time to live in milli seconds.
*
* @param maxTimeToLiveInMilliSeconds the max time to live in milli seconds
*/
@Deprecated
public void setMaxTimeToLiveInMilliSeconds(final long maxTimeToLiveInMilliSeconds){
this.maxTimeToLiveInMilliSeconds = maxTimeToLiveInMilliSeconds;
}
/**
* @deprecated As of 4.1.
* Sets time to kill in milli seconds.
*
* @param timeToKillInMilliSeconds the time to kill in milli seconds
*/
@Deprecated
public void setTimeToKillInMilliSeconds(final long timeToKillInMilliSeconds) {
this.timeToKillInMilliSeconds = timeToKillInMilliSeconds;
}
/**
* @deprecated As of 4.1.
* Convenient virtual property setter to set time in seconds.
* @param maxTimeToLiveInSeconds max number of seconds for the tickets to stay alive
**/
@Deprecated
public void setMaxTimeToLiveInSeconds(final long maxTimeToLiveInSeconds){
if(this.maxTimeToLiveInMilliSeconds == 0L) {
this.maxTimeToLiveInMilliSeconds = TimeUnit.SECONDS.toMillis(maxTimeToLiveInSeconds);
}
}
/**
* @deprecated As of 4.1.
* @param timeToKillInSeconds time for the ticket to stay active in seconds
* Convenient virtual property setter to set time in seconds.
**/
@Deprecated
public void setTimeToKillInSeconds(final long timeToKillInSeconds) {
if(this.timeToKillInMilliSeconds == 0L) {
this.timeToKillInMilliSeconds = TimeUnit.SECONDS.toMillis(timeToKillInSeconds);
}
}
@Override
public void afterPropertiesSet() throws Exception {
......
......@@ -50,7 +50,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
/**
* Implementationn of CAS {@link HttpClient}
* Implementation of CAS {@link HttpClient}
* which delegates requests to a {@link #httpClient} instance.
*
* @author Jerome Leleu
......@@ -165,86 +165,9 @@ final class SimpleHttpClient implements HttpClient, Serializable, DisposableBean
* Shutdown the executor service and close the http client.
* @throws Exception if the executor cannot properly shut down
*/
@Override
public void destroy() throws Exception {
IOUtils.closeQuietly(this.requestExecutorService);
}
/**
* @deprecated As of 4.1
* Note that changing this executor will affect all httpClients. While not ideal, this change
* was made because certain ticket registries
* were persisting the HttpClient and thus getting serializable exceptions.
* @param executorService The executor service to send messages to end points.
*/
@Deprecated
public void setExecutorService(@NotNull final ExecutorService executorService) {
LOGGER.warn("setExecutorService() is deprecated and has no effect. Consider using SimpleHttpClientFactoryBean instead.");
}
/**
* @deprecated As of 4.1
* Set the acceptable HTTP status codes that we will use to determine if the
* response from the URL was correct.
*
* @param acceptableCodes an array of status code integers.
*/
@Deprecated
public void setAcceptableCodes(final int[] acceptableCodes) {
LOGGER.warn("setAcceptableCodes() is deprecated and has no effect. Consider using SimpleHttpClientFactoryBean instead.");
}
/**
* @deprecated As of 4.1
* Sets a specified timeout value, in milliseconds, to be used when opening the endpoint url.
* @param connectionTimeout specified timeout value in milliseconds
*/
@Deprecated
public void setConnectionTimeout(final int connectionTimeout) {
LOGGER.warn("setConnectionTimeout() is deprecated and has no effect. Consider using SimpleHttpClientFactoryBean instead.");
}
/**
* @deprecated As of 4.1
* Sets a specified timeout value, in milliseconds, to be used when reading from the endpoint url.
* @param readTimeout specified timeout value in milliseconds
*/
@Deprecated
public void setReadTimeout(final int readTimeout) {
LOGGER.warn("setReadTimeout() is deprecated and has no effect. Consider using SimpleHttpClientFactoryBean instead.");
}
/**
* @deprecated As of 4.1
* Determines the behavior on receiving 3xx responses from HTTP endpoints.
*
* @param follow True to follow 3xx redirects (default), false otherwise.
*/
@Deprecated
public void setFollowRedirects(final boolean follow) {
LOGGER.warn("setFollowRedirects() is deprecated and has no effect. Consider using SimpleHttpClientFactoryBean instead.");
}
/**
* @deprecated As of 4.1
* Set the SSL socket factory be used by the URL when submitting
* request to check for URL endpoint validity.
* @param factory ssl socket factory instance to use
* @see #isValidEndPoint(URL)
*/
@Deprecated
public void setSSLSocketFactory(final SSLSocketFactory factory) {
LOGGER.warn("setSSLSocketFactory() is deprecated and has no effect. Consider using SimpleHttpClientFactoryBean instead.");
}
/**
* @deprecated As of 4.1
* Set the hostname verifier be used by the URL when submitting
* request to check for URL endpoint validity.
* @param verifier hostname verifier instance to use
* @see #isValidEndPoint(URL)
*/
@Deprecated
public void setHostnameVerifier(final HostnameVerifier verifier) {
LOGGER.warn("setHostnameVerifier() is deprecated and has no effect. Consider using SimpleHttpClientFactoryBean instead.");
}
}
/*
* Licensed to Apereo under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Apereo licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jasig.cas.remoting.server;
import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.TestUtils;
import org.jasig.cas.authentication.AuthenticationException;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.ticket.TicketGrantingTicket;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.fail;