mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
dbeaver/pro#2452 Session auth info model
This commit is contained in:
+13
-1
@@ -22,6 +22,7 @@ import io.cloudbeaver.model.user.WebUserOriginInfo;
|
||||
import io.cloudbeaver.registry.WebAuthProviderDescriptor;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.auth.SMAuthInfo;
|
||||
import org.jkiss.dbeaver.model.auth.SMAuthProvider;
|
||||
import org.jkiss.dbeaver.model.auth.SMSession;
|
||||
import org.jkiss.dbeaver.model.auth.SMSessionPrincipal;
|
||||
@@ -41,7 +42,10 @@ public class WebAuthInfo implements SMSessionPrincipal {
|
||||
private final WebUser user;
|
||||
private final WebAuthProviderDescriptor authProvider;
|
||||
private String authProviderConfigurationId;
|
||||
private SMSession authSession;
|
||||
@NotNull
|
||||
private final SMAuthInfo authInfo;
|
||||
@NotNull
|
||||
private final SMSession authSession;
|
||||
private final OffsetDateTime loginTime;
|
||||
private final DBWUserIdentity userIdentity;
|
||||
private String message;
|
||||
@@ -54,12 +58,14 @@ public class WebAuthInfo implements SMSessionPrincipal {
|
||||
@NotNull WebAuthProviderDescriptor authProvider,
|
||||
@NotNull DBWUserIdentity userIdentity,
|
||||
@NotNull SMSession authSession,
|
||||
@NotNull SMAuthInfo authInfo,
|
||||
@NotNull OffsetDateTime loginTime
|
||||
) {
|
||||
this.session = session;
|
||||
this.user = user;
|
||||
this.authProvider = authProvider;
|
||||
this.userIdentity = userIdentity;
|
||||
this.authInfo = authInfo;
|
||||
this.authSession = authSession;
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
@@ -120,10 +126,16 @@ public class WebAuthInfo implements SMSessionPrincipal {
|
||||
return authProvider;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SMSession getAuthSession() {
|
||||
return authSession;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SMAuthInfo getAuthInfo() {
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
void closeAuth() {
|
||||
if (authProvider != null && authSession != null) {
|
||||
try {
|
||||
|
||||
+9
-1
@@ -91,7 +91,7 @@ import java.util.stream.Collectors;
|
||||
* Is the main source of data in web application
|
||||
*/
|
||||
public class WebSession extends BaseWebSession
|
||||
implements SMSession, SMCredentialsProvider, DBACredentialsProvider, IAdaptable {
|
||||
implements SMSessionWithAuth, SMCredentialsProvider, DBACredentialsProvider, IAdaptable {
|
||||
|
||||
private static final Log log = Log.getLog(WebSession.class);
|
||||
|
||||
@@ -813,6 +813,14 @@ public class WebSession extends BaseWebSession
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SMAuthInfo> getAuthInfos() {
|
||||
synchronized (authTokens) {
|
||||
return authTokens.stream().map(WebAuthInfo::getAuthInfo).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<WebAuthInfo> getAllAuthInfo() {
|
||||
synchronized (authTokens) {
|
||||
return new ArrayList<>(authTokens);
|
||||
|
||||
+1
@@ -164,6 +164,7 @@ public class WebSessionAuthProcessor {
|
||||
authProviderDescriptor,
|
||||
userIdentity,
|
||||
authSession,
|
||||
authInfo,
|
||||
OffsetDateTime.now()
|
||||
);
|
||||
webAuthInfo.setAuthProviderConfigurationId(authConfiguration.getAuthProviderConfigurationId());
|
||||
|
||||
Reference in New Issue
Block a user