41 final Rp site =
getRp();
43 OpenIdConfigurationResponse discoveryResponse =
getDiscoveryService().getConnectDiscoveryResponse(site);
44 String endSessionEndpoint = discoveryResponse.getEndSessionEndpoint();
46 String postLogoutRedirectUrl =
params.getPostLogoutRedirectUri();
47 if (Strings.isNullOrEmpty(postLogoutRedirectUrl)) {
48 postLogoutRedirectUrl = site.getPostLogoutRedirectUri();
50 if (Strings.isNullOrEmpty(postLogoutRedirectUrl)) {
51 postLogoutRedirectUrl =
"";
54 if (Strings.isNullOrEmpty(endSessionEndpoint)) {
55 if (site.getOpHost().startsWith(
GOOGLE_OP_HOST) &&
getInstance(ConfigurationService.class).get().getSupportGoogleLogout()) {
56 String logoutUrl =
"https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=" + postLogoutRedirectUrl;
57 return okResponse(
new LogoutResponse(logoutUrl));
61 throw new ErrorResponseException(ErrorResponseCode.FAILED_TO_GET_END_SESSION_ENDPOINT);
64 String uri = endSessionEndpoint +
66 if (!Strings.isNullOrEmpty(postLogoutRedirectUrl)) {
67 uri +=
"&post_logout_redirect_uri=" + URLEncoder.encode(postLogoutRedirectUrl,
"UTF-8");
69 if (!Strings.isNullOrEmpty(
params.getState())) {
70 uri +=
"&state=" +
params.getState();
72 if (!Strings.isNullOrEmpty(
params.getSessionState())) {
73 uri +=
"&session_state=" +
params.getSessionState();
String getIdToken(GetLogoutUrlParams params, Rp site)
Definition: GetLogoutUrlOperation.java:79
CommandResponse okResponse(IOpResponse p_data)
Definition: BaseOperation.java:145
static final Logger LOG
Definition: GetLogoutUrlOperation.java:28
DiscoveryService getDiscoveryService()
Definition: BaseOperation.java:96
static final String GOOGLE_OP_HOST
Definition: GetLogoutUrlOperation.java:26
Rp getRp()
Definition: BaseOperation.java:117
final T params
Definition: BaseOperation.java:40
public< T > T getInstance(Class< T > type)
Definition: BaseOperation.java:84