mirror of https://github.com/jacekkow/keycloak-protocol-cas

Jacek Kowalski
11 hours ago 7b839951b7d2cb088a557c642c2dec65bc5953ce
src/main/java/org/keycloak/protocol/cas/endpoints/AbstractValidateEndpoint.java
@@ -40,6 +40,7 @@
    protected RealmModel realm;
    protected EventBuilder event;
    protected ClientModel client;
    protected String service;
    protected AuthenticatedClientSessionModel clientSession;
    protected String pgtIou;
@@ -83,6 +84,8 @@
            throw new CASValidationException(CASErrorCode.INVALID_SERVICE, "Client disabled", Response.Status.BAD_REQUEST);
        }
        this.service = RedirectUtils.verifyRedirectUri(session, service, client);
        event.client(client.getClientId());
        session.getContext().setClient(client);
@@ -162,6 +165,12 @@
            throw new CASValidationException(CASErrorCode.INVALID_TICKET, "Code is expired", Response.Status.BAD_REQUEST);
        }
        // Service and proxy tickets are valid only for the service they were issued for
        if (!isReusable && (service == null || !service.equals(codeData.getRedirectUriParam()))) {
            event.error(Errors.INVALID_REDIRECT_URI);
            throw new CASValidationException(CASErrorCode.INVALID_SERVICE, "Ticket was not issued for this service", Response.Status.BAD_REQUEST);
        }
        clientSession.setNote(CASLoginProtocol.SESSION_TICKET, ticket);
        if (requireReauth && AuthenticationManager.isSSOAuthentication(clientSession)) {