Skip to content

Commit

Permalink
CB-5710 anonymous access disabled active user fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yagudin10 committed Oct 9, 2024
1 parent 1f1a9d2 commit 9ab0f12
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.cloudbeaver.auth.SMSignOutLinkProvider;
import io.cloudbeaver.auth.provider.local.LocalAuthProvider;
import io.cloudbeaver.model.WebPropertyInfo;
import io.cloudbeaver.model.app.WebAppConfiguration;
import io.cloudbeaver.model.session.WebAuthInfo;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.model.session.WebSessionAuthProcessor;
Expand Down Expand Up @@ -189,9 +190,13 @@ public WebLogoutInfo authLogout(
@Override
public WebUserInfo activeUser(@NotNull WebSession webSession) throws DBWebException {
if (webSession.getUser() == null) {
WebAppConfiguration appConfiguration = webSession.getApplication().getAppConfiguration();
if (!appConfiguration.isAnonymousAccessEnabled()) {
return null;
}
SMUser anonymous = new SMUser("anonymous", true, null);
anonymous.setUserTeams(
new String[]{webSession.getApplication().getAppConfiguration().getAnonymousUserTeam()}
new String[]{appConfiguration.getAnonymousUserTeam()}
);
return new WebUserInfo(webSession, new WebUser(anonymous));
}
Expand Down

0 comments on commit 9ab0f12

Please sign in to comment.