mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-5734 return template configuration for auth provider (#3162)
* CB-5734 return template configuration for auth provider * CB-5734 feat: fetch templateConfiguration --------- Co-authored-by: Sychev Andrey <44414066+SychevAndrey@users.noreply.github.com> Co-authored-by: Andrey Sychev <nukemoore@gmail.com> Co-authored-by: Evgenia <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
co-authored by
Sychev Andrey
Andrey Sychev
Evgenia
parent
92ee21d136
commit
ca83a1f167
+1
-1
@@ -30,7 +30,7 @@ import java.util.Map;
|
||||
public interface SMAuthProviderFederated extends SMSignOutLinkProvider {
|
||||
|
||||
@NotNull
|
||||
String getSignInLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException;
|
||||
String getSignInLink(String id) throws DBException;
|
||||
|
||||
@Override
|
||||
default String getUserSignOutLink(
|
||||
|
||||
+15
-9
@@ -74,8 +74,8 @@ public class WebAuthProviderConfiguration {
|
||||
@Property
|
||||
public String getSignInLink() throws DBException {
|
||||
SMAuthProvider<?> instance = providerDescriptor.getInstance();
|
||||
return instance instanceof SMAuthProviderFederated ?
|
||||
buildRedirectUrl(((SMAuthProviderFederated) instance).getSignInLink(getId(), config.getParameters()))
|
||||
return instance instanceof SMAuthProviderFederated smAuthProviderFederated ?
|
||||
buildRedirectUrl(smAuthProviderFederated.getSignInLink(getId()))
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -86,34 +86,40 @@ public class WebAuthProviderConfiguration {
|
||||
@Property
|
||||
public String getSignOutLink() throws DBException {
|
||||
SMAuthProvider<?> instance = providerDescriptor.getInstance();
|
||||
return instance instanceof SMSignOutLinkProvider
|
||||
? ((SMSignOutLinkProvider) instance).getCommonSignOutLink(getId(), config.getParameters())
|
||||
return instance instanceof SMSignOutLinkProvider smSignOutLinkProvider
|
||||
? smSignOutLinkProvider.getCommonSignOutLink(getId(), config.getParameters())
|
||||
: null;
|
||||
}
|
||||
|
||||
@Property
|
||||
public String getRedirectLink() throws DBException {
|
||||
SMAuthProvider<?> instance = providerDescriptor.getInstance();
|
||||
return instance instanceof SMAuthProviderFederated ? ((SMAuthProviderFederated) instance).getRedirectLink(getId(), config.getParameters()) : null;
|
||||
return instance instanceof SMAuthProviderFederated smAuthProviderFederated
|
||||
? smAuthProviderFederated.getRedirectLink(getId(), config.getParameters())
|
||||
: null;
|
||||
}
|
||||
|
||||
@Property
|
||||
public String getMetadataLink() throws DBException {
|
||||
SMAuthProvider<?> instance = providerDescriptor.getInstance();
|
||||
return instance instanceof SMAuthProviderFederated ? ((SMAuthProviderFederated) instance).getMetadataLink(getId(), config.getParameters()) : null;
|
||||
return instance instanceof SMAuthProviderFederated smAuthProviderFederated
|
||||
? smAuthProviderFederated.getMetadataLink(getId(), config.getParameters())
|
||||
: null;
|
||||
}
|
||||
|
||||
@Property
|
||||
public String getAcsLink() throws DBException {
|
||||
SMAuthProvider<?> instance = providerDescriptor.getInstance();
|
||||
return instance instanceof SMAuthProviderFederated ? ((SMAuthProviderFederated) instance).getAcsLink(getId(), config.getParameters()) : null;
|
||||
return instance instanceof SMAuthProviderFederated smAuthProviderFederated
|
||||
? smAuthProviderFederated.getAcsLink(getId(), config.getParameters())
|
||||
: null;
|
||||
}
|
||||
|
||||
@Property
|
||||
public String getEntityIdLink() throws DBException {
|
||||
SMAuthProvider<?> instance = providerDescriptor.getInstance();
|
||||
return instance instanceof SMAuthProviderFederated
|
||||
? ((SMAuthProviderFederated) instance).getEntityIdLink(getId(), config.getParameters())
|
||||
return instance instanceof SMAuthProviderFederated smAuthProviderFederated
|
||||
? smAuthProviderFederated.getEntityIdLink(getId(), config.getParameters())
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,8 @@ type AuthProviderInfo {
|
||||
# Provider configurations (applicable only if configurable=true)
|
||||
configurations: [AuthProviderConfiguration!]
|
||||
|
||||
templateConfiguration: AuthProviderConfiguration! @since(version: "24.1.2")
|
||||
|
||||
credentialProfiles: [AuthProviderCredentialsProfile!]!
|
||||
|
||||
requiredFeatures: [String!]!
|
||||
|
||||
+8
-6
@@ -20,11 +20,11 @@ import io.cloudbeaver.WebServiceUtils;
|
||||
import io.cloudbeaver.auth.SMAuthProviderFederated;
|
||||
import io.cloudbeaver.auth.provisioning.SMProvisioner;
|
||||
import io.cloudbeaver.model.app.ServletAuthConfiguration;
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import io.cloudbeaver.registry.WebAuthProviderConfiguration;
|
||||
import io.cloudbeaver.registry.WebAuthProviderDescriptor;
|
||||
import io.cloudbeaver.server.CBApplication;
|
||||
import io.cloudbeaver.server.WebAppUtils;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.security.SMAuthCredentialsProfile;
|
||||
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
|
||||
@@ -38,17 +38,15 @@ import java.util.List;
|
||||
public class WebAuthProviderInfo {
|
||||
|
||||
private static final Log log = Log.getLog(WebAuthProviderInfo.class);
|
||||
private static final SMAuthProviderCustomConfiguration TEMPLATE_CONFIG = new SMAuthProviderCustomConfiguration("{configuration_id}");
|
||||
|
||||
@NotNull
|
||||
private final WebAuthProviderDescriptor descriptor;
|
||||
|
||||
public WebAuthProviderInfo(WebAuthProviderDescriptor descriptor) {
|
||||
public WebAuthProviderInfo(@NotNull WebAuthProviderDescriptor descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
|
||||
WebAuthProviderDescriptor getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return descriptor.getId();
|
||||
}
|
||||
@@ -126,6 +124,10 @@ public class WebAuthProviderInfo {
|
||||
return rf == null ? new String[0] : rf;
|
||||
}
|
||||
|
||||
public WebAuthProviderConfiguration getTemplateConfiguration() {
|
||||
return new WebAuthProviderConfiguration(descriptor, TEMPLATE_CONFIG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getLabel();
|
||||
|
||||
+1
-1
@@ -1607,7 +1607,7 @@ public class CBEmbeddedSecurityController<T extends ServletAuthApplication>
|
||||
if (SMAuthProviderFederated.class.isAssignableFrom(authProviderInstance.getClass())) {
|
||||
//async auth
|
||||
var authProviderFederated = (SMAuthProviderFederated) authProviderInstance;
|
||||
String signInLink = buildRedirectLink(authProviderFederated.getSignInLink(authProviderConfigurationId, Map.of()),
|
||||
String signInLink = buildRedirectLink(authProviderFederated.getSignInLink(authProviderConfigurationId),
|
||||
authAttemptId);
|
||||
String signOutLink = authProviderFederated.getCommonSignOutLink(authProviderConfigurationId,
|
||||
providerConfig.getParameters());
|
||||
|
||||
@@ -9,6 +9,14 @@ fragment AuthProviderInfo on AuthProviderInfo {
|
||||
supportProvisioning
|
||||
required
|
||||
authHidden
|
||||
templateConfiguration {
|
||||
id
|
||||
signInLink
|
||||
signOutLink
|
||||
metadataLink
|
||||
acsLink
|
||||
entityIdLink
|
||||
}
|
||||
|
||||
#configurationParameters {
|
||||
# id
|
||||
|
||||
Reference in New Issue
Block a user