148 if (managementUrl != null) {
151 MultivaluedHashMap<String, String> adapterSessionIds = null;
152 List<String> userSessions =
new LinkedList<>();
153 if (clientSessions != null && clientSessions.size() > 0) {
154 adapterSessionIds =
new MultivaluedHashMap<String, String>();
155 for (AuthenticatedClientSessionModel clientSession : clientSessions) {
156 String adapterSessionId = clientSession.getNote(AdapterConstants.CLIENT_SESSION_STATE);
157 if (adapterSessionId != null) {
158 String host = clientSession.getNote(AdapterConstants.CLIENT_SESSION_HOST);
159 adapterSessionIds.add(host, adapterSessionId);
161 if (clientSession.getUserSession() != null) userSessions.add(clientSession.getUserSession().getId());
165 if (adapterSessionIds == null || adapterSessionIds.isEmpty()) {
166 logger.debugv(
"Can't logout {0}: no logged adapter sessions", resource.getClientId());
171 boolean allPassed =
true;
173 for (Map.Entry<String, List<String>> entry : adapterSessionIds.entrySet()) {
174 String host = entry.getKey();
175 List<String> sessionIds = entry.getValue();
177 allPassed =
sendLogoutRequest(realm, resource, sessionIds, userSessions, 0, currentHostMgmtUrl) && allPassed;
183 List<String> allSessionIds =
new ArrayList<String>();
184 for (List<String> currentIds : adapterSessionIds.values()) {
185 allSessionIds.addAll(currentIds);
188 return sendLogoutRequest(realm, resource, allSessionIds, userSessions, 0, managementUrl);
191 logger.debugv(
"Can't logout {0}: no management url", resource.getClientId());
static String getManagementUrl(URI requestUri, ClientModel client)
Definition: ResourceAdminManager.java:73
boolean sendLogoutRequest(RealmModel realm, ClientModel resource, List< String > adapterSessionIds, List< String > userSessions, int notBefore, String managementUrl)
Definition: ResourceAdminManager.java:238
static final String CLIENT_SESSION_HOST_PROPERTY
Definition: ResourceAdminManager.java:59
static final Logger logger
Definition: ResourceAdminManager.java:58