Commit 82596206 authored by Misagh Moayyed's avatar Misagh Moayyed
Browse files

removed deprecated concepts

parent ee161a0b
......@@ -23,7 +23,7 @@ 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.TicketException;
import org.jasig.cas.ticket.AbstractTicketException;
import org.jasig.cas.ticket.InvalidTicketException;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.ticket.Ticket;
......@@ -66,10 +66,10 @@ public interface CentralAuthenticationService {
* @return Non-null ticket-granting ticket identifier.
*
* @throws AuthenticationException on errors authenticating the credentials
* @throws org.jasig.cas.ticket.TicketException if ticket cannot be created
* @throws AbstractTicketException if ticket cannot be created
*/
TicketGrantingTicket createTicketGrantingTicket(@NotNull Credential... credentials)
throws AuthenticationException, TicketException;
throws AuthenticationException, AbstractTicketException;
/**
......@@ -111,9 +111,9 @@ public interface CentralAuthenticationService {
*
* @return Non-null service ticket identifier.
*
* @throws org.jasig.cas.ticket.TicketException if the ticket could not be created.
* @throws AbstractTicketException if the ticket could not be created.
*/
ServiceTicket grantServiceTicket(@NotNull String ticketGrantingTicketId, @NotNull Service service) throws TicketException;
ServiceTicket grantServiceTicket(@NotNull String ticketGrantingTicketId, @NotNull Service service) throws AbstractTicketException;
/**
* Grant a {@link org.jasig.cas.ticket.ServiceTicket} that may be used to access the given service
......@@ -133,11 +133,11 @@ public interface CentralAuthenticationService {
* @return Non-null service ticket identifier.
*
* @throws AuthenticationException on errors authenticating the credentials
* @throws org.jasig.cas.ticket.TicketException if the ticket could not be created.
* @throws AbstractTicketException if the ticket could not be created.
*/
ServiceTicket grantServiceTicket(
@NotNull final String ticketGrantingTicketId, @NotNull final Service service, final Credential... credentials)
throws AuthenticationException, TicketException;
throws AuthenticationException, AbstractTicketException;
/**
* Validate a ServiceTicket for a particular Service.
......@@ -147,9 +147,9 @@ public interface CentralAuthenticationService {
*
* @return Non-null ticket validation assertion.
*
* @throws org.jasig.cas.ticket.TicketException if there was an error validating the ticket.
* @throws AbstractTicketException if there was an error validating the ticket.
*/
Assertion validateServiceTicket(@NotNull final String serviceTicketId, @NotNull final Service service) throws TicketException;
Assertion validateServiceTicket(@NotNull final String serviceTicketId, @NotNull final Service service) throws AbstractTicketException;
/**
* Destroy a TicketGrantingTicket and perform back channel logout. This has the effect of invalidating any
......@@ -173,8 +173,8 @@ public interface CentralAuthenticationService {
* that proxy authentication.
*
* @throws AuthenticationException on errors authenticating the credentials
* @throws org.jasig.cas.ticket.TicketException if there was an error creating the ticket
* @throws AbstractTicketException if there was an error creating the ticket
*/
TicketGrantingTicket delegateTicketGrantingTicket(@NotNull final String serviceTicketId, @NotNull final Credential... credentials)
throws AuthenticationException, TicketException;
throws AuthenticationException, AbstractTicketException;
}
......@@ -18,6 +18,8 @@
*/
package org.jasig.cas.authentication;
import org.jasig.cas.ticket.AbstractTicketException;
import javax.validation.constraints.NotNull;
/**
......@@ -27,7 +29,7 @@ import javax.validation.constraints.NotNull;
*
* @author Misagh Moayyed
* see org.jasig.cas.authentication.handler.AuthenticationException
* @see org.jasig.cas.ticket.TicketException
* @see AbstractTicketException
* @since 4.0.0
*/
public abstract class RootCasException extends Exception {
......
......@@ -21,14 +21,12 @@ package org.jasig.cas.ticket;
import org.jasig.cas.authentication.RootCasException;
/**
* Generic ticket exception. Top of the TicketException hierarchy.
* Generic ticket exception. Top of the AbstractTicketException hierarchy.
*
* @author Scott Battaglia
* @since 3.0.0
* @deprecated As of 4.1, the class is required to note its abstractness in the name and will be renamed in the future.
* @since 4.2.0
*/
@Deprecated
public abstract class TicketException extends RootCasException {
public abstract class AbstractTicketException extends RootCasException {
private static final long serialVersionUID = -5128676415951733624L;
/**
......@@ -37,7 +35,7 @@ public abstract class TicketException extends RootCasException {
* @param code the code
* @param throwable the throwable
*/
public TicketException(final String code, final Throwable throwable) {
public AbstractTicketException(final String code, final Throwable throwable) {
super(code, throwable);
}
......@@ -46,7 +44,7 @@ public abstract class TicketException extends RootCasException {
*
* @param code the code
*/
public TicketException(final String code) {
public AbstractTicketException(final String code) {
super(code);
}
......@@ -56,7 +54,7 @@ public abstract class TicketException extends RootCasException {
* @param code the code
* @param msg the msg
*/
public TicketException(final String code, final String msg) {
public AbstractTicketException(final String code, final String msg) {
super(code, msg);
}
}
......@@ -19,12 +19,12 @@
package org.jasig.cas.ticket;
/**
* TicketException to alert that a Ticket was not found or that it is expired.
* AbstractTicketException to alert that a Ticket was not found or that it is expired.
*
* @author Scott Battaglia
* @since 3.0.0
*/
public class InvalidTicketException extends TicketException {
public class InvalidTicketException extends AbstractTicketException {
private static final long serialVersionUID = 9141891414482490L;
......
......@@ -23,6 +23,7 @@ import com.codahale.metrics.annotation.Metered;
import com.codahale.metrics.annotation.Timed;
import org.jasig.cas.authentication.AuthenticationBuilder;
import org.jasig.cas.logout.LogoutRequest;
import org.jasig.cas.ticket.AbstractTicketException;
import org.jasig.inspektr.audit.annotation.Audit;
import org.apache.commons.collections4.Predicate;
import org.jasig.cas.authentication.AcceptAnyAuthenticationPolicyFactory;
......@@ -53,7 +54,6 @@ import org.jasig.cas.ticket.InvalidTicketException;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.ticket.Ticket;
import org.jasig.cas.ticket.TicketCreationException;
import org.jasig.cas.ticket.TicketException;
import org.jasig.cas.ticket.TicketGrantingTicket;
import org.jasig.cas.ticket.TicketGrantingTicketImpl;
import org.jasig.cas.ticket.UnrecognizableServiceForServiceTicketValidationException;
......@@ -248,7 +248,7 @@ public final class CentralAuthenticationServiceImpl implements CentralAuthentica
public ServiceTicket grantServiceTicket(
final String ticketGrantingTicketId,
final Service service, final Credential... credentials)
throws AuthenticationException, TicketException {
throws AuthenticationException, AbstractTicketException {
final TicketGrantingTicket ticketGrantingTicket = getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
......@@ -377,7 +377,7 @@ public final class CentralAuthenticationServiceImpl implements CentralAuthentica
@Counted(name="GRANT_SERVICE_TICKET_COUNTER", monotonic=true)
@Override
public ServiceTicket grantServiceTicket(final String ticketGrantingTicketId,
final Service service) throws TicketException {
final Service service) throws AbstractTicketException {
try {
return this.grantServiceTicket(ticketGrantingTicketId, service, (Credential[]) null);
} catch (final AuthenticationException e) {
......@@ -394,7 +394,7 @@ public final class CentralAuthenticationServiceImpl implements CentralAuthentica
@Counted(name="GRANT_PROXY_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public TicketGrantingTicket delegateTicketGrantingTicket(final String serviceTicketId, final Credential... credentials)
throws AuthenticationException, TicketException {
throws AuthenticationException, AbstractTicketException {
final ServiceTicket serviceTicket = this.serviceTicketRegistry.getTicket(serviceTicketId, ServiceTicket.class);
......@@ -434,7 +434,7 @@ public final class CentralAuthenticationServiceImpl implements CentralAuthentica
@Metered(name="VALIDATE_SERVICE_TICKET_METER")
@Counted(name="VALIDATE_SERVICE_TICKET_COUNTER", monotonic=true)
@Override
public Assertion validateServiceTicket(final String serviceTicketId, final Service service) throws TicketException {
public Assertion validateServiceTicket(final String serviceTicketId, final Service service) throws AbstractTicketException {
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
verifyRegisteredServiceProperties(registeredService, service);
......@@ -497,7 +497,7 @@ public final class CentralAuthenticationServiceImpl implements CentralAuthentica
@Counted(name="CREATE_TICKET_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public TicketGrantingTicket createTicketGrantingTicket(final Credential... credentials)
throws AuthenticationException, TicketException {
throws AuthenticationException, AbstractTicketException {
final Set<Credential> sanitizedCredentials = sanitizeCredentials(credentials);
if (sanitizedCredentials.size() > 0) {
......@@ -608,10 +608,10 @@ public final class CentralAuthenticationServiceImpl implements CentralAuthentica
* @param ticket the ticket
* @param context the context
* @return the authentication satisfied by policy
* @throws org.jasig.cas.ticket.TicketException the ticket exception
* @throws AbstractTicketException the ticket exception
*/
private Authentication getAuthenticationSatisfiedByPolicy(
final TicketGrantingTicket ticket, final ServiceContext context) throws TicketException {
final TicketGrantingTicket ticket, final ServiceContext context) throws AbstractTicketException {
final ContextualAuthenticationPolicy<ServiceContext> policy =
serviceContextAuthenticationPolicyFactory.createPolicy(context);
......
......@@ -28,11 +28,9 @@ import javax.validation.constraints.NotNull;
* other AuthenticationExceptions.
*
* @author Scott Battaglia
* @since 3.0.0
* @deprecated As of 4.1, the class is required to note its abstractness in the name and will be renamed in the future.
* @since 4.2.0
*/
@Deprecated
public abstract class AuthenticationException extends RootCasException {
public abstract class AbstractAuthenticationException extends RootCasException {
/** Serializable ID. */
private static final long serialVersionUID = 3906648604830611762L;
......@@ -47,7 +45,7 @@ public abstract class AuthenticationException extends RootCasException {
*
* @param code the code
*/
public AuthenticationException(final String code) {
public AbstractAuthenticationException(final String code) {
this(code, "", DEFAULT_TYPE);
}
......@@ -57,7 +55,7 @@ public abstract class AuthenticationException extends RootCasException {
* @param code the code
* @param msg the msg
*/
public AuthenticationException(final String code, final String msg) {
public AbstractAuthenticationException(final String code, final String msg) {
this(code, msg, DEFAULT_TYPE);
}
......@@ -67,7 +65,7 @@ public abstract class AuthenticationException extends RootCasException {
* @param code the exception code
* @param msg the error message
*/
public AuthenticationException(final String code, final String msg, @NotNull final String type) {
public AbstractAuthenticationException(final String code, final String msg, @NotNull final String type) {
super(code, msg);
this.type = type;
}
......@@ -76,7 +74,7 @@ public abstract class AuthenticationException extends RootCasException {
* @param code the exception code
* @param throwable the exception that originally caused the authentication failure
*/
public AuthenticationException(final String code, final Throwable throwable) {
public AbstractAuthenticationException(final String code, final Throwable throwable) {
super(code, throwable);
this.type = DEFAULT_TYPE;
}
......
......@@ -24,7 +24,7 @@ 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.TicketException;
import org.jasig.cas.ticket.AbstractTicketException;
import org.jasig.cas.ticket.InvalidTicketException;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.ticket.Ticket;
......@@ -76,7 +76,7 @@ public final class RemoteCentralAuthenticationService implements CentralAuthenti
*/
@Override
public TicketGrantingTicket createTicketGrantingTicket(final Credential... credentials)
throws AuthenticationException, TicketException {
throws AuthenticationException, AbstractTicketException {
Assert.notNull(credentials, "credentials cannot be null");
checkForErrors(credentials);
......@@ -89,7 +89,7 @@ public final class RemoteCentralAuthenticationService implements CentralAuthenti
*/
@Override
public ServiceTicket grantServiceTicket(final String ticketGrantingTicketId, final Service service)
throws TicketException {
throws AbstractTicketException {
return this.centralAuthenticationService.grantServiceTicket(ticketGrantingTicketId, service);
}
......@@ -108,7 +108,7 @@ public final class RemoteCentralAuthenticationService implements CentralAuthenti
@Override
public ServiceTicket grantServiceTicket(
final String ticketGrantingTicketId, final Service service, final Credential... credentials)
throws AuthenticationException, TicketException {
throws AuthenticationException, AbstractTicketException {
checkForErrors(credentials);
......@@ -128,7 +128,7 @@ public final class RemoteCentralAuthenticationService implements CentralAuthenti
* {@inheritDoc}
*/
@Override
public Assertion validateServiceTicket(final String serviceTicketId, final Service service) throws TicketException {
public Assertion validateServiceTicket(final String serviceTicketId, final Service service) throws AbstractTicketException {
return this.centralAuthenticationService.validateServiceTicket(serviceTicketId, service);
}
......@@ -152,7 +152,7 @@ public final class RemoteCentralAuthenticationService implements CentralAuthenti
*/
@Override
public TicketGrantingTicket delegateTicketGrantingTicket(final String serviceTicketId, final Credential... credentials)
throws AuthenticationException, TicketException {
throws AuthenticationException, AbstractTicketException {
checkForErrors(credentials);
......
......@@ -331,7 +331,7 @@ public abstract class AbstractRegisteredService implements RegisteredService, Co
}
@Override
public final RegisteredService clone() {
public final AbstractRegisteredService clone() {
final AbstractRegisteredService clone = newInstance();
clone.copyFrom(this);
return clone;
......
......@@ -24,11 +24,9 @@ import org.jasig.cas.authentication.principal.Service;
* Exception to alert that there was an error validating the ticket.
*
* @author Scott Battaglia
* @since 3.0.0
* @deprecated As of 4.1, the class is required to note its abstractness in the name and will be renamed in the future.
* @since 4.2.0
*/
@Deprecated
public abstract class TicketValidationException extends TicketException {
public abstract class AbstractTicketValidationException extends AbstractTicketException {
/** The code description. */
protected static final String CODE = "INVALID_TICKET";
......@@ -38,11 +36,11 @@ public abstract class TicketValidationException extends TicketException {
private final Service service;
/**
* Constructs a TicketValidationException with the default exception code
* Constructs a AbstractTicketValidationException with the default exception code
* and the original exception that was thrown.
* @param service original service
*/
public TicketValidationException(final Service service) {
public AbstractTicketValidationException(final Service service) {
this(CODE, service);
}
......@@ -53,7 +51,7 @@ public abstract class TicketValidationException extends TicketException {
* @param service the service
* @since 4.1
*/
public TicketValidationException(final String code, final Service service) {
public AbstractTicketValidationException(final String code, final Service service) {
super(code);
this.service = service;
}
......
......@@ -25,7 +25,7 @@ package org.jasig.cas.ticket;
* @since 3.0.0
*/
public class TicketCreationException extends TicketException {
public class TicketCreationException extends AbstractTicketException {
/** Serializable ID for unique id. */
private static final long serialVersionUID = 5501212207531289993L;
......
......@@ -125,9 +125,7 @@ public final class TicketGrantingTicketImpl extends AbstractTicket implements Ti
this(id, null, null, authentication, policy);
}
/**
* {@inheritDoc}
*/
@Override
public Authentication getAuthentication() {
return this.authentication;
......@@ -189,17 +187,13 @@ public final class TicketGrantingTicketImpl extends AbstractTicket implements Ti
return this.getGrantingTicket() == null;
}
/**
* {@inheritDoc}
*/
@Override
public void markTicketExpired() {
this.expired = Boolean.TRUE;
}
/**
* {@inheritDoc}
*/
@Override
public TicketGrantingTicket getRoot() {
TicketGrantingTicket current = this;
......@@ -221,17 +215,13 @@ public final class TicketGrantingTicketImpl extends AbstractTicket implements Ti
return this.expired;
}
/**
* {@inheritDoc}
*/
@Override
public List<Authentication> getSupplementalAuthentications() {
return this.supplementalAuthentications;
}
/**
* {@inheritDoc}
*/
@Override
public List<Authentication> getChainedAuthentications() {
final List<Authentication> list = new ArrayList<>();
......@@ -251,9 +241,7 @@ public final class TicketGrantingTicketImpl extends AbstractTicket implements Ti
return this.proxiedBy;
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(final Object object) {
if (object == null) {
......
......@@ -28,7 +28,7 @@ import org.jasig.cas.authentication.principal.Service;
* @author Misagh Moayyed
* @since 4.1
*/
public class UnrecognizableServiceForServiceTicketValidationException extends TicketValidationException {
public class UnrecognizableServiceForServiceTicketValidationException extends AbstractTicketValidationException {
/** The code description. */
protected static final String CODE = "INVALID_SERVICE";
......
......@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* @author Marvin S. Addison
* @since 4.0.0
*/
public class UnsatisfiedAuthenticationPolicyException extends TicketException {
public class UnsatisfiedAuthenticationPolicyException extends AbstractTicketException {
/** Serializable ID for unique id. */
private static final long serialVersionUID = -827432780367197133L;
......
......@@ -29,17 +29,15 @@ import javax.servlet.http.HttpServletResponse;
* Abstract class to be extended by all controllers that may become a delegate.
* All subclass must implement the canHandle method to say if they can handle a request or not.
* @author Frederic Esnault
* @since 3.5
* @deprecated As of 4.1, the class is required to note its abstractness in the name and will be renamed in the future.
* @since 4.2.0
*/
@Deprecated
public abstract class DelegateController extends AbstractController {
public abstract class AbstractDelegateController extends AbstractController {
/** The logger. */
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* Determine if a DelegateController subclass can handle the current request.
* Determine if a AbstractDelegateController subclass can handle the current request.
* @param request the current request
* @param response the response
* @return true if the controller can handler the request, false otherwise
......
......@@ -24,7 +24,7 @@ import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.principal.DefaultPrincipalFactory;
import org.jasig.cas.authentication.principal.PrincipalFactory;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.ticket.TicketException;
import org.jasig.cas.ticket.AbstractTicketException;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.web.support.WebUtils;
import org.slf4j.Logger;
......@@ -97,7 +97,7 @@ public abstract class AbstractNonInteractiveCredentialsAction extends AbstractAc
} catch (final AuthenticationException e) {
onError(context, credential);
return error();
} catch (final TicketException e) {
} catch (final AbstractTicketException e) {
this.centralAuthenticationService.destroyTicketGrantingTicket(ticketGrantingTicketId);
logger.debug("Attempted to generate a ServiceTicket using renew=true with different credential", e);
}
......
......@@ -27,8 +27,8 @@ import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.services.UnauthorizedServiceException;
import org.jasig.cas.services.UnauthorizedServiceForPrincipalException;
import org.jasig.cas.services.UnauthorizedSsoServiceException;
import org.jasig.cas.ticket.AbstractTicketException;
import org.jasig.cas.ticket.TicketCreationException;
import org.jasig.cas.ticket.TicketException;
import org.jasig.cas.ticket.ExpirationPolicy;
import org.jasig.cas.ticket.ServiceTicket;
import org.jasig.cas.ticket.TicketGrantingTicket;
......@@ -64,7 +64,7 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
assertNotNull(getCentralAuthenticationService()
.createTicketGrantingTicket(
TestUtils.getCredentialsWithSameUsernameAndPassword()));
} catch (final TicketException e) {
} catch (final AbstractTicketException e) {
fail(TestUtils.CONST_EXCEPTION_NON_EXPECTED);
}
}
......@@ -162,7 +162,7 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
assertTrue(pt.getId().startsWith(ServiceTicket.PROXY_TICKET_PREFIX));
}
@Test(expected=TicketException.class)
@Test(expected=AbstractTicketException.class)
public void verifyGrantServiceTicketWithInvalidTicketGrantingTicket() throws Exception {
final TicketGrantingTicket ticketId = getCentralAuthenticationService()
.createTicketGrantingTicket(
......@@ -172,7 +172,7 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
TestUtils.getService());
}
@Test(expected=TicketException.class)
@Test(expected=AbstractTicketException.class)
public void verifyGrantServiceTicketWithExpiredTicketGrantingTicket() throws Exception {
((CentralAuthenticationServiceImpl) getCentralAuthenticationService()).setTicketGrantingTicketExpirationPolicy(
new ExpirationPolicy() {
......@@ -206,7 +206,7 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
assertTrue(pgt.getId().startsWith(TicketGrantingTicket.PROXY_GRANTING_TICKET_PREFIX));
}
@Test(expected=TicketException.class)
@Test(expected=AbstractTicketException.class)
public void verifyDelegateTicketGrantingTicketWithBadServiceTicket() throws Exception {
final TicketGrantingTicket ticketId = getCentralAuthenticationService()
.createTicketGrantingTicket(
......@@ -281,7 +281,7 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
serviceTicket.getId(), TestUtils.getService("test2"));
}
@Test(expected=TicketException.class)
@Test(expected=AbstractTicketException.class)
public void verifyValidateServiceTicketWithInvalidServiceTicket() throws Exception {
final TicketGrantingTicket ticketGrantingTicket = getCentralAuthenticationService()
.createTicketGrantingTicket(
......@@ -295,7 +295,7 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
serviceTicket.getId(), TestUtils.getService());
}
@Test(expected=TicketException.class)
@Test(expected=AbstractTicketException.class)
public void verifyValidateServiceTicketNonExistantTicket() throws Exception {
getCentralAuthenticationService().validateServiceTicket("test",
TestUtils.getService());
......@@ -444,11 +444,11 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
* failed as it only expects one authentication. Thus supplemental authentications should not be returned in the
* chained authentications. Both concepts are orthogonal.
*
* @throws org.jasig.cas.ticket.TicketException
* @throws AbstractTicketException
* @throws AuthenticationException
*/
@Test
public void authenticateTwiceWithRenew() throws TicketException, AuthenticationException {
public void authenticateTwiceWithRenew() throws AbstractTicketException, AuthenticationException {
final CentralAuthenticationService cas = getCentralAuthenticationService();
final Service svc = TestUtils.getService("testDefault");
final UsernamePasswordCredential goodCredential = TestUtils.getCredentialsWithSameUsernameAndPassword();
......@@ -466,10 +466,10 @@ public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthen
* It previously failed when the deletion happens before the ticket was marked expired because an update was necessary for that.
*
* @throws AuthenticationException
* @throws org.jasig.cas.ticket.TicketException
* @throws AbstractTicketException
*/