Hello
It's a bit dated issue, however we have the same issue on v 5.2.5.

Anyway, I think the issue is still present on master actually.

The error’s message is clear:  it’s caused of a database’s constraint
between two table OAUTH_TOKENS and TICKETGRANTINGTICKET on the field
TICKETGRANTINGTICKET_ID of OAUTH_TOKENS.

Digging on the code, on the class JpaTicketRegistry, the function
deleteTicketGrantingTickets()

https://github.com/apereo/cas/blob/ab784b404df8a12eaae58b66fae78d8199277663/support/cas-server-support-jpa-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/JpaTicketRegistry.java#L184

Inside this function, only the ServiceTicket, TicketGrantingTicket and
linked TicketGrantingTicket are suppressed.

Obviously, all the other oauth2’s tickets : meaning  OAuthCode,
AccessToken, RefreshToken are forgotten or are not implemented yet …

So, we can patch the code with something similar

        // patch
        final TicketDefinition at =
this.ticketCatalog.find(AccessToken.PREFIX);
        String sqlText = "delete from " + getTicketEntityName(at) + " s
where s.ticketGrantingTicket.id = :id";
        LOGGER.debug("AT " + sqlText);
        query = entityManager.createQuery(sqlText);
        query.setParameter("id", ticketId);
        totalCount += query.executeUpdate();

And this code is needed to repeat also for RefreshToken.PREFIX and
OAuthCode.PREFIX

 @leleuj and  @mmoayyed, do you think that’s is a right place to do the
patch ?

Thanks
Quang.









Le mar. 20 févr. 2018 à 02:43, Elena <[email protected]> a écrit :

> +) i use cas 5.2.2
>
> --
> - Website: https://apereo.github.io/cas
> - Gitter Chatroom: https://gitter.im/apereo/cas
> - List Guidelines: https://goo.gl/1VRrw7
> - Contributions: https://goo.gl/mh7qDG
> ---
> You received this message because you are subscribed to the Google Groups
> "CAS Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/899d39bd-f96c-404d-a5b2-73a704e0aaa2%40apereo.org
> .
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAJKnBGjci8ET025NTd5vRvth9eQaPGb46ExLPr9cvHJRXdphMw%40mail.gmail.com.

Reply via email to