@Override
public SignOutResult execImpl(SignOut a, ExecutionContext ec) {
ICoreSessionService sessionService = sessionServicesProvider.get();
AuthSession authSession = sessionService.get();
String alternateRedirectUrl = null;
SignOutResult result = new SignOutResult();
if (a.isSignOutOfApp()) {
if (authSession == null) {
Logger.warn("Requested to log out of app when not logged in");
}
else {
sessionService.close(authSession);
}
}
if (a.isSignOutOfExternalService()) {
String authServiceName = null;
if (authSession != null) {
authServiceName = authSession.getAuthServiceName();
}
else {
authServiceName = a.getAuthServiceName();
}
if (authServiceName == null) {
Logger.warn("No auth service could be found to log out of");
}
else {
IAuthService service =
serviceProvider.getAuthServices().get(authServiceName);
if (service != null) {
alternateRedirectUrl = service.getSignOutUrl(
authSession != null
? authSession.getServiceSpecificSessionId()
: null);
}
}
}