KEYCLOAK-4626 Authentication sessions - SAML, offline tokens, broker logout and other fixes
This commit is contained in:
1 parent
47aaa5a636
commit
168153c6e7
102 files changed
+2589
-3188
No files matched your search
@@ -30,8 +30,8 @@ public interface AuthenticatedClientSessionModel extends CommonClientSessionMode
|
||||
void setUserSession(UserSessionModel userSession);
|
||||
UserSessionModel getUserSession();
|
||||
|
||||
public String getNote(String name);
|
||||
public void setNote(String name, String value);
|
||||
public void removeNote(String name);
|
||||
public Map<String, String> getNotes();
|
||||
String getNote(String name);
|
||||
void setNote(String name, String value);
|
||||
void removeNote(String name);
|
||||
Map<String, String> getNotes();
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
package org.keycloak.models;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -55,9 +54,6 @@ public interface UserSessionModel {
|
||||
|
||||
Map<String, AuthenticatedClientSessionModel> getAuthenticatedClientSessions();
|
||||
|
||||
// TODO: Remove
|
||||
List<ClientSessionModel> getClientSessions();
|
||||
|
||||
public String getNote(String name);
|
||||
public void setNote(String name, String value);
|
||||
public void removeNote(String name);
|
||||
@@ -68,8 +64,10 @@ public interface UserSessionModel {
|
||||
|
||||
void setUser(UserModel user);
|
||||
|
||||
// Will completely restart whole state of user session. It will just keep same ID.
|
||||
void restartSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId);
|
||||
|
||||
public static enum State {
|
||||
LOGGING_IN, // TODO:mposolda Maybe state "LOGGING_IN" is useless now once userSession is attached after requiredActions
|
||||
LOGGED_IN,
|
||||
LOGGING_OUT,
|
||||
LOGGED_OUT
|
||||
|
||||
@@ -27,10 +27,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface UserSessionProvider extends Provider {
|
||||
|
||||
ClientSessionModel createClientSession(RealmModel realm, ClientModel client);
|
||||
AuthenticatedClientSessionModel createClientSession(RealmModel realm, ClientModel client, UserSessionModel userSession);
|
||||
ClientSessionModel getClientSession(RealmModel realm, String id);
|
||||
ClientSessionModel getClientSession(String id);
|
||||
|
||||
UserSessionModel createUserSession(String id, RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId);
|
||||
UserSessionModel getUserSession(RealmModel realm, String id);
|
||||
@@ -42,14 +39,13 @@ public interface UserSessionProvider extends Provider {
|
||||
|
||||
long getActiveUserSessions(RealmModel realm, ClientModel client);
|
||||
|
||||
// This will remove attached ClientLoginSessionModels too
|
||||
/** This will remove attached ClientLoginSessionModels too **/
|
||||
void removeUserSession(RealmModel realm, UserSessionModel session);
|
||||
void removeUserSessions(RealmModel realm, UserModel user);
|
||||
|
||||
// Implementation should propagate removal of expired userSessions to userSessionPersister too
|
||||
/** Implementation should propagate removal of expired userSessions to userSessionPersister too **/
|
||||
void removeExpired(RealmModel realm);
|
||||
void removeUserSessions(RealmModel realm);
|
||||
void removeClientSession(RealmModel realm, ClientSessionModel clientSession);
|
||||
|
||||
UserLoginFailureModel getUserLoginFailure(RealmModel realm, String userId);
|
||||
UserLoginFailureModel addUserLoginFailure(RealmModel realm, String userId);
|
||||
@@ -59,25 +55,22 @@ public interface UserSessionProvider extends Provider {
|
||||
void onRealmRemoved(RealmModel realm);
|
||||
void onClientRemoved(RealmModel realm, ClientModel client);
|
||||
|
||||
/** Newly created userSession won't contain attached AuthenticatedClientSessions **/
|
||||
UserSessionModel createOfflineUserSession(UserSessionModel userSession);
|
||||
UserSessionModel getOfflineUserSession(RealmModel realm, String userSessionId);
|
||||
|
||||
// Removes the attached clientSessions as well
|
||||
/** Removes the attached clientSessions as well **/
|
||||
void removeOfflineUserSession(RealmModel realm, UserSessionModel userSession);
|
||||
|
||||
AuthenticatedClientSessionModel createOfflineClientSession(AuthenticatedClientSessionModel clientSession);
|
||||
ClientSessionModel getOfflineClientSession(RealmModel realm, String clientSessionId);
|
||||
/** Will automatically attach newly created offline client session to the offlineUserSession **/
|
||||
AuthenticatedClientSessionModel createOfflineClientSession(AuthenticatedClientSessionModel clientSession, UserSessionModel offlineUserSession);
|
||||
List<UserSessionModel> getOfflineUserSessions(RealmModel realm, UserModel user);
|
||||
|
||||
// Don't remove userSession even if it's last userSession
|
||||
void removeOfflineClientSession(RealmModel realm, String clientSessionId);
|
||||
|
||||
long getOfflineSessionsCount(RealmModel realm, ClientModel client);
|
||||
List<UserSessionModel> getOfflineUserSessions(RealmModel realm, ClientModel client, int first, int max);
|
||||
|
||||
// Triggered by persister during pre-load
|
||||
UserSessionModel importUserSession(UserSessionModel persistentUserSession, boolean offline);
|
||||
ClientSessionModel importClientSession(ClientSessionModel persistentClientSession, boolean offline);
|
||||
/** Triggered by persister during pre-load. It optionally imports authenticatedClientSessions too if requested. Otherwise the imported UserSession will have empty list of AuthenticationSessionModel **/
|
||||
UserSessionModel importUserSession(UserSessionModel persistentUserSession, boolean offline, boolean importAuthenticatedClientSessions);
|
||||
|
||||
ClientInitialAccessModel createClientInitialAccessModel(RealmModel realm, int expiration, int count);
|
||||
ClientInitialAccessModel getClientInitialAccessModel(RealmModel realm, String id);
|
||||
|
||||
@@ -35,7 +35,6 @@ public interface AuthenticationSessionProvider extends Provider {
|
||||
|
||||
void removeAuthenticationSession(RealmModel realm, AuthenticationSessionModel authenticationSession);
|
||||
|
||||
// TODO: test and add to scheduler
|
||||
void removeExpired(RealmModel realm);
|
||||
void onRealmRemoved(RealmModel realm);
|
||||
void onClientRemoved(RealmModel realm, ClientModel client);
|
||||
|
||||
Reference in new issue
Block a user