package org.apereo.cas.client;

import org.apereo.cas.CentralAuthenticationService;
import org.jasig.cas.client.authentication.AttributePrincipalImpl;
import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.AssertionImpl;
import org.jasig.cas.client.validation.TicketValidator;

/**
 * This is a ticket validator for pac4j client that uses CAS back channels to validate ST.
 *
 * @author Kirill Gagarski
 * @since 6.1.0
 */
public class CasBackchannelTicketValidator implements TicketValidator {
    private final CentralAuthenticationService cas;

    public CasBackchannelTicketValidator(final CentralAuthenticationService cas) {
        this.cas = cas;
    }

    @Override
    public Assertion validate(final String ticketId, final String service) {
        final org.apereo.cas.validation.Assertion ass = cas.validateServiceTicket(ticketId, () -> service);

        return new AssertionImpl(new AttributePrincipalImpl(
                ass.getPrimaryAuthentication().getPrincipal().getId(),
                ass.getPrimaryAuthentication().getPrincipal().getAttributes()));
    }
}

@@ -792,41 +792,13 @@
     
-final org.apereo.cas.validation.A
+val a
 sser
@@ -802,20 +802,16 @@
 sertion 
-ass 
 = cas.va
@@ -856,25 +856,24 @@
 rvice);%0A
-%0A
         
 return n
@@ -868,80 +868,33 @@
     
-return new AssertionImpl(new AttributePrincipalImpl(%0A                ass
+val principal = assertion
 .get
@@ -935,17 +935,9 @@
 al()
-.getId(),
+;
 %0A   
@@ -941,24 +941,25 @@
         
+%0A
         
 ass.getP
@@ -954,51 +954,88 @@
     
-ass.getPrimaryAuthentication().getP
+return new AssertionImpl(new AttributePrincipalImpl(principal.getId(), p
 rincipal
 ().g
@@ -1030,18 +1030,16 @@
 rincipal
-()
 .getAttr

Update CasBackchannelTicketValidator.java