// Path: src/main/java/net/unicon/cas/addons/authentication/AuthenticationSupport.java
// public interface AuthenticationSupport {
// 
//     /**
//      * Retrieve a valid Authentication object identified by the provided TGT SSO token
//      * @param ticketGrantingTicketId an SSO token identifying the requested Authentication
//      * @return valid Authentication OR <b>NULL</b> if there is no valid SSO session present identified by the provided TGT id SSO token
//      * @throws RuntimeException
//      */
//     Authentication getAuthenticationFrom(String ticketGrantingTicketId) throws RuntimeException;
// 
//     /**
//      * Retrieve a valid Principal object identified by the provided TGT SSO token
//      * @param ticketGrantingTicketId an SSO token identifying the requested authenticated Principal
//      * @return valid Principal OR <b>NULL</b> if there is no valid SSO session present identified by the provided TGT id SSO token
//      * @throws RuntimeException
//      */
//     Principal getAuthenticatedPrincipalFrom(String ticketGrantingTicketId) throws RuntimeException;
// 
//     /**
//      * Retrieve a valid Principal's map of attributes identified by the provided TGT SSO token
//      * @param ticketGrantingTicketId an SSO token identifying the requested authenticated Principal's attributes
//      * @return valid Principal's attributes OR <b>NULL</b> if there is no valid SSO session present identified by the provided TGT id SSO token
//      * @throws RuntimeException
//      */
//     Map<String, Object> getPrincipalAttributesFrom(String ticketGrantingTicketId) throws RuntimeException;
// }


import net.unicon.cas.addons.authentication.AuthenticationSupport;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.jasig.cas.authentication.Authentication;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
package net.unicon.cas.addons.info.events;


/**
 * Aspect implementing a mechanism by which to intercept core CAS runtime events and publish them as Spring <code>ApplicationEvent</code>s
 * to <code>ApplicationContext</code> in which CAS server is deployed for further consumption by any number of registered <code>ApplicationListener</code>s.
 * <p/>
 * The events published by this aspect are {@link CasSsoSessionEstablishedEvent}, {@link CasSsoSessionDestroyedEvent}, {@link CasServiceTicketGrantedEvent}, {@link CasServiceTicketValidatedEvent}
 *
 * @author Dmitriy Kopylenko
 * @author Unicon, inc.
 * @since 1.1
 */
@Aspect
public class CentralAuthenticationServiceEventsPublishingAspect implements ApplicationEventPublisherAware {

	private ApplicationEventPublisher eventPublisher;

// Path: src/main/java/net/unicon/cas/addons/authentication/AuthenticationSupport.java
// public interface AuthenticationSupport {
// 
//     /**
//      * Retrieve a valid Authentication object identified by the provided TGT SSO token
//      * @param ticketGrantingTicketId an SSO token identifying the requested Authentication
//      * @return valid Authentication OR <b>NULL</b> if there is no valid SSO session present identified by the provided TGT id SSO token
//      * @throws RuntimeException
//      */
//     Authentication getAuthenticationFrom(String ticketGrantingTicketId) throws RuntimeException;
// 
//     /**
//      * Retrieve a valid Principal object identified by the provided TGT SSO token
//      * @param ticketGrantingTicketId an SSO token identifying the requested authenticated Principal
//      * @return valid Principal OR <b>NULL</b> if there is no valid SSO session present identified by the provided TGT id SSO token
//      * @throws RuntimeException
//      */
//     Principal getAuthenticatedPrincipalFrom(String ticketGrantingTicketId) throws RuntimeException;
// 
//     /**
//      * Retrieve a valid Principal's map of attributes identified by the provided TGT SSO token
//      * @param ticketGrantingTicketId an SSO token identifying the requested authenticated Principal's attributes
//      * @return valid Principal's attributes OR <b>NULL</b> if there is no valid SSO session present identified by the provided TGT id SSO token
//      * @throws RuntimeException
//      */
//     Map<String, Object> getPrincipalAttributesFrom(String ticketGrantingTicketId) throws RuntimeException;
// }


// Path: src/main/java/net/unicon/cas/addons/info/events/CentralAuthenticationServiceEventsPublishingAspect.java
import net.unicon.cas.addons.authentication.AuthenticationSupport;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.jasig.cas.authentication.Authentication;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;

package net.unicon.cas.addons.info.events;


/**
 * Aspect implementing a mechanism by which to intercept core CAS runtime events and publish them as Spring <code>ApplicationEvent</code>s
 * to <code>ApplicationContext</code> in which CAS server is deployed for further consumption by any number of registered <code>ApplicationListener</code>s.
 * <p/>
 * The events published by this aspect are {@link CasSsoSessionEstablishedEvent}, {@link CasSsoSessionDestroyedEvent}, {@link CasServiceTicketGrantedEvent}, {@link CasServiceTicketValidatedEvent}
 *
 * @author Dmitriy Kopylenko
 * @author Unicon, inc.
 * @since 1.1
 */
@Aspect
public class CentralAuthenticationServiceEventsPublishingAspect implements ApplicationEventPublisherAware {

	private ApplicationEventPublisher eventPublisher;

	private final AuthenticationSupport authenticationSupport;