| | |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | | import javax.ws.rs.core.UriInfo; |
| | | |
| | | public class LogoutEndpoint { |
| | | private static final Logger logger = Logger.getLogger(LogoutEndpoint.class); |
| | |
| | | |
| | | @Context |
| | | private HttpHeaders headers; |
| | | |
| | | @Context |
| | | private UriInfo uriInfo; |
| | | |
| | | private RealmModel realm; |
| | | private EventBuilder event; |
| | |
| | | if (redirectUri != null) userSession.setNote(CASLoginProtocol.LOGOUT_REDIRECT_URI, redirectUri); |
| | | |
| | | logger.debug("Initiating CAS browser logout"); |
| | | Response response = AuthenticationManager.browserLogout(session, realm, authResult.getSession(), uriInfo, clientConnection, headers); |
| | | Response response = AuthenticationManager.browserLogout(session, realm, authResult.getSession(), session.getContext().getUri(), clientConnection, headers); |
| | | logger.debug("finishing CAS browser logout"); |
| | | return response; |
| | | } |
| | | return ErrorPage.error(session, Messages.FAILED_LOGOUT); |
| | | return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.FAILED_LOGOUT); |
| | | } |
| | | |
| | | private void checkClient(String service) { |
| | |
| | | return; |
| | | } |
| | | |
| | | client = realm.getClients().stream() |
| | | client = realm.getClientsStream() |
| | | .filter(c -> CASLoginProtocol.LOGIN_PROTOCOL.equals(c.getProtocol())) |
| | | .filter(c -> RedirectUtils.verifyRedirectUri(uriInfo, service, realm, c) != null) |
| | | .filter(c -> RedirectUtils.verifyRedirectUri(session, service, c) != null) |
| | | .findFirst().orElse(null); |
| | | if (client != null) { |
| | | redirectUri = RedirectUtils.verifyRedirectUri(uriInfo, service, realm, client); |
| | | redirectUri = RedirectUtils.verifyRedirectUri(session, service, client); |
| | | |
| | | session.getContext().setClient(client); |
| | | } |