From f50570e3506d11e8ac176117941c42766e2827a3 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 4 Jun 2015 15:59:28 +0200 Subject: [PATCH] KEYCLOAK-1325 Public/private SPI --- .../provider/IdentityProviderMapperSpi.java | 4 +- .../broker/provider/IdentityProviderSpi.java | 2 +- .../connections/file/FileConnectionSpi.java | 2 +- .../connections/httpclient/HttpClientSpi.java | 2 +- .../infinispan/InfinispanConnectionSpi.java | 2 +- .../connections/jpa/JpaConnectionSpi.java | 2 +- .../jpa/updater/JpaUpdaterSpi.java | 2 +- .../connections/mongo/MongoConnectionSpi.java | 2 +- .../mongo/updater/MongoUpdaterSpi.java | 2 +- .../org/keycloak/events/EventListenerSpi.java | 2 +- .../org/keycloak/events/EventStoreSpi.java | 2 +- .../org/keycloak/exportimport/ExportSpi.java | 2 +- .../org/keycloak/exportimport/ImportSpi.java | 2 +- .../java/org/keycloak/account/AccountSpi.java | 2 +- .../org/keycloak/freemarker/ThemeSpi.java | 2 +- .../admin/resources/partials/server-info.html | 34 +++++++++++++-- .../java/org/keycloak/email/EmailSpi.java | 2 +- .../org/keycloak/login/LoginFormsSpi.java | 2 +- .../mappers/UserFederationMapperSpi.java | 4 +- .../org/keycloak/migration/MigrationSpi.java | 2 +- .../java/org/keycloak/models/RealmSpi.java | 2 +- .../keycloak/models/UserFederationSpi.java | 2 +- .../org/keycloak/models/UserSessionSpi.java | 2 +- .../java/org/keycloak/models/UserSpi.java | 2 +- .../main/java/org/keycloak/provider/Spi.java | 8 ++-- .../models/cache/CacheRealmProviderSpi.java | 2 +- .../models/cache/CacheUserProviderSpi.java | 2 +- .../authentication/AuthenticatorSpi.java | 2 +- .../exportimport/ClientImportSpi.java | 2 +- .../org/keycloak/messages/MessagesSpi.java | 2 +- .../keycloak/protocol/LoginProtocolSpi.java | 2 +- .../keycloak/protocol/ProtocolMapperSpi.java | 4 +- .../DefaultKeycloakSessionFactory.java | 6 +-- .../admin/ServerInfoAdminResource.java | 42 +++++++++++++++++-- .../org/keycloak/wellknown/WellKnownSpi.java | 2 +- .../keycloak/social/SocialProviderSpi.java | 2 +- .../org/keycloak/testsuite/utils/ListSpi.java | 34 --------------- .../java/org/keycloak/timer/TimerSpi.java | 2 +- 38 files changed, 111 insertions(+), 85 deletions(-) delete mode 100644 testsuite/integration/src/test/java/org/keycloak/testsuite/utils/ListSpi.java diff --git a/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderMapperSpi.java b/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderMapperSpi.java index 44fb65d5ed..b0ac20a4e8 100755 --- a/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderMapperSpi.java +++ b/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderMapperSpi.java @@ -10,8 +10,8 @@ import org.keycloak.provider.Spi; public class IdentityProviderMapperSpi implements Spi { @Override - public boolean isPrivate() { - return false; + public boolean isInternal() { + return true; } @Override diff --git a/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java b/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java index b507e551c2..3348bd2523 100644 --- a/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java +++ b/broker/core/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java @@ -29,7 +29,7 @@ public class IdentityProviderSpi implements Spi { public static final String IDENTITY_PROVIDER_SPI_NAME = "identity_provider"; @Override - public boolean isPrivate() { + public boolean isInternal() { return false; } diff --git a/connections/file/src/main/java/org/keycloak/connections/file/FileConnectionSpi.java b/connections/file/src/main/java/org/keycloak/connections/file/FileConnectionSpi.java index ec64192281..5929a0ba61 100644 --- a/connections/file/src/main/java/org/keycloak/connections/file/FileConnectionSpi.java +++ b/connections/file/src/main/java/org/keycloak/connections/file/FileConnectionSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class FileConnectionSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/connections/http-client/src/main/java/org/keycloak/connections/httpclient/HttpClientSpi.java b/connections/http-client/src/main/java/org/keycloak/connections/httpclient/HttpClientSpi.java index 510b1648bc..01cbaa3f4f 100755 --- a/connections/http-client/src/main/java/org/keycloak/connections/httpclient/HttpClientSpi.java +++ b/connections/http-client/src/main/java/org/keycloak/connections/httpclient/HttpClientSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class HttpClientSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/connections/infinispan/src/main/java/org/keycloak/connections/infinispan/InfinispanConnectionSpi.java b/connections/infinispan/src/main/java/org/keycloak/connections/infinispan/InfinispanConnectionSpi.java index f76c070673..a4db87ec43 100644 --- a/connections/infinispan/src/main/java/org/keycloak/connections/infinispan/InfinispanConnectionSpi.java +++ b/connections/infinispan/src/main/java/org/keycloak/connections/infinispan/InfinispanConnectionSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class InfinispanConnectionSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/connections/jpa/src/main/java/org/keycloak/connections/jpa/JpaConnectionSpi.java b/connections/jpa/src/main/java/org/keycloak/connections/jpa/JpaConnectionSpi.java index d565357534..61eb8165fb 100644 --- a/connections/jpa/src/main/java/org/keycloak/connections/jpa/JpaConnectionSpi.java +++ b/connections/jpa/src/main/java/org/keycloak/connections/jpa/JpaConnectionSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class JpaConnectionSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterSpi.java b/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterSpi.java index c9bd8ee380..eaddc278ce 100644 --- a/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterSpi.java +++ b/connections/jpa/src/main/java/org/keycloak/connections/jpa/updater/JpaUpdaterSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class JpaUpdaterSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/connections/mongo/src/main/java/org/keycloak/connections/mongo/MongoConnectionSpi.java b/connections/mongo/src/main/java/org/keycloak/connections/mongo/MongoConnectionSpi.java index f391dfd651..9c5c53274f 100644 --- a/connections/mongo/src/main/java/org/keycloak/connections/mongo/MongoConnectionSpi.java +++ b/connections/mongo/src/main/java/org/keycloak/connections/mongo/MongoConnectionSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class MongoConnectionSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/connections/mongo/src/main/java/org/keycloak/connections/mongo/updater/MongoUpdaterSpi.java b/connections/mongo/src/main/java/org/keycloak/connections/mongo/updater/MongoUpdaterSpi.java index 830aaa339c..ed92458d9e 100644 --- a/connections/mongo/src/main/java/org/keycloak/connections/mongo/updater/MongoUpdaterSpi.java +++ b/connections/mongo/src/main/java/org/keycloak/connections/mongo/updater/MongoUpdaterSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class MongoUpdaterSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/events/api/src/main/java/org/keycloak/events/EventListenerSpi.java b/events/api/src/main/java/org/keycloak/events/EventListenerSpi.java index a16ad46bde..a3eedd17f7 100644 --- a/events/api/src/main/java/org/keycloak/events/EventListenerSpi.java +++ b/events/api/src/main/java/org/keycloak/events/EventListenerSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class EventListenerSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return false; } diff --git a/events/api/src/main/java/org/keycloak/events/EventStoreSpi.java b/events/api/src/main/java/org/keycloak/events/EventStoreSpi.java index af5f59f018..256b7e46ca 100644 --- a/events/api/src/main/java/org/keycloak/events/EventStoreSpi.java +++ b/events/api/src/main/java/org/keycloak/events/EventStoreSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class EventStoreSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ExportSpi.java b/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ExportSpi.java index 208cc6aa61..bcc91b4cfe 100644 --- a/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ExportSpi.java +++ b/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ExportSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class ExportSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ImportSpi.java b/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ImportSpi.java index 90cb6ac79e..f6f5968966 100644 --- a/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ImportSpi.java +++ b/export-import/export-import-api/src/main/java/org/keycloak/exportimport/ImportSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class ImportSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/forms/account-api/src/main/java/org/keycloak/account/AccountSpi.java b/forms/account-api/src/main/java/org/keycloak/account/AccountSpi.java index 2c9843ebc1..3d2072a652 100644 --- a/forms/account-api/src/main/java/org/keycloak/account/AccountSpi.java +++ b/forms/account-api/src/main/java/org/keycloak/account/AccountSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class AccountSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/forms/common-freemarker/src/main/java/org/keycloak/freemarker/ThemeSpi.java b/forms/common-freemarker/src/main/java/org/keycloak/freemarker/ThemeSpi.java index 94db863159..9e97cb9f9d 100644 --- a/forms/common-freemarker/src/main/java/org/keycloak/freemarker/ThemeSpi.java +++ b/forms/common-freemarker/src/main/java/org/keycloak/freemarker/ThemeSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class ThemeSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/server-info.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/server-info.html index ff818a2708..c0d66001b9 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/server-info.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/server-info.html @@ -14,7 +14,11 @@
Providers +
+

Public SPIs

+ For public SPIs there are built-in providers, but it's also supported to write your own custom providers. + @@ -23,10 +27,34 @@ - - + + + + +
{{spi}}
{{spi.name}} -
+
+ {{provider}} +
+
+
+ +
+

Internal SPIs

+ For internal SPIs there are only built-in providers. It's not recommended to write your own custom providers as internal SPIs may change or be removed without notice. + + + + + + + + + + + + diff --git a/forms/email-api/src/main/java/org/keycloak/email/EmailSpi.java b/forms/email-api/src/main/java/org/keycloak/email/EmailSpi.java index cde73cec0f..8d085336c6 100644 --- a/forms/email-api/src/main/java/org/keycloak/email/EmailSpi.java +++ b/forms/email-api/src/main/java/org/keycloak/email/EmailSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class EmailSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/forms/login-api/src/main/java/org/keycloak/login/LoginFormsSpi.java b/forms/login-api/src/main/java/org/keycloak/login/LoginFormsSpi.java index f99292aeb1..dc18703b70 100644 --- a/forms/login-api/src/main/java/org/keycloak/login/LoginFormsSpi.java +++ b/forms/login-api/src/main/java/org/keycloak/login/LoginFormsSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class LoginFormsSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/model/api/src/main/java/org/keycloak/mappers/UserFederationMapperSpi.java b/model/api/src/main/java/org/keycloak/mappers/UserFederationMapperSpi.java index f668058d3e..9597f08887 100644 --- a/model/api/src/main/java/org/keycloak/mappers/UserFederationMapperSpi.java +++ b/model/api/src/main/java/org/keycloak/mappers/UserFederationMapperSpi.java @@ -25,7 +25,7 @@ public class UserFederationMapperSpi implements Spi { } @Override - public boolean isPrivate() { - return false; + public boolean isInternal() { + return true; } } diff --git a/model/api/src/main/java/org/keycloak/migration/MigrationSpi.java b/model/api/src/main/java/org/keycloak/migration/MigrationSpi.java index e599146a89..cc9601a366 100644 --- a/model/api/src/main/java/org/keycloak/migration/MigrationSpi.java +++ b/model/api/src/main/java/org/keycloak/migration/MigrationSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class MigrationSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/model/api/src/main/java/org/keycloak/models/RealmSpi.java b/model/api/src/main/java/org/keycloak/models/RealmSpi.java index f531cd918f..ce49557510 100755 --- a/model/api/src/main/java/org/keycloak/models/RealmSpi.java +++ b/model/api/src/main/java/org/keycloak/models/RealmSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class RealmSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/model/api/src/main/java/org/keycloak/models/UserFederationSpi.java b/model/api/src/main/java/org/keycloak/models/UserFederationSpi.java index c17c02a393..6b977513ce 100755 --- a/model/api/src/main/java/org/keycloak/models/UserFederationSpi.java +++ b/model/api/src/main/java/org/keycloak/models/UserFederationSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class UserFederationSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return false; } diff --git a/model/api/src/main/java/org/keycloak/models/UserSessionSpi.java b/model/api/src/main/java/org/keycloak/models/UserSessionSpi.java index 8755660fad..993eb9ecd0 100644 --- a/model/api/src/main/java/org/keycloak/models/UserSessionSpi.java +++ b/model/api/src/main/java/org/keycloak/models/UserSessionSpi.java @@ -12,7 +12,7 @@ public class UserSessionSpi implements Spi { public static final String NAME = "userSessions"; @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/model/api/src/main/java/org/keycloak/models/UserSpi.java b/model/api/src/main/java/org/keycloak/models/UserSpi.java index 1d6cd74545..af834e8e61 100755 --- a/model/api/src/main/java/org/keycloak/models/UserSpi.java +++ b/model/api/src/main/java/org/keycloak/models/UserSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class UserSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/model/api/src/main/java/org/keycloak/provider/Spi.java b/model/api/src/main/java/org/keycloak/provider/Spi.java index be68251697..e88b66b7ad 100644 --- a/model/api/src/main/java/org/keycloak/provider/Spi.java +++ b/model/api/src/main/java/org/keycloak/provider/Spi.java @@ -5,9 +5,9 @@ package org.keycloak.provider; */ public interface Spi { - public boolean isPrivate(); - public String getName(); - public Class getProviderClass(); - public Class getProviderFactoryClass(); + boolean isInternal(); + String getName(); + Class getProviderClass(); + Class getProviderFactoryClass(); } diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheRealmProviderSpi.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheRealmProviderSpi.java index 300b8f0d1b..bff04a9af7 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheRealmProviderSpi.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheRealmProviderSpi.java @@ -11,7 +11,7 @@ import org.keycloak.provider.Spi; public class CacheRealmProviderSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheUserProviderSpi.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheUserProviderSpi.java index 9e0affa8e6..989f062362 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheUserProviderSpi.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/CacheUserProviderSpi.java @@ -11,7 +11,7 @@ import org.keycloak.provider.Spi; public class CacheUserProviderSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/services/src/main/java/org/keycloak/authentication/AuthenticatorSpi.java b/services/src/main/java/org/keycloak/authentication/AuthenticatorSpi.java index 684d07420c..81b0373e25 100755 --- a/services/src/main/java/org/keycloak/authentication/AuthenticatorSpi.java +++ b/services/src/main/java/org/keycloak/authentication/AuthenticatorSpi.java @@ -11,7 +11,7 @@ import org.keycloak.provider.Spi; public class AuthenticatorSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return false; } diff --git a/services/src/main/java/org/keycloak/exportimport/ClientImportSpi.java b/services/src/main/java/org/keycloak/exportimport/ClientImportSpi.java index e59a45af74..47a777e307 100755 --- a/services/src/main/java/org/keycloak/exportimport/ClientImportSpi.java +++ b/services/src/main/java/org/keycloak/exportimport/ClientImportSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class ClientImportSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/services/src/main/java/org/keycloak/messages/MessagesSpi.java b/services/src/main/java/org/keycloak/messages/MessagesSpi.java index 6e820068c8..dd8b2669a4 100644 --- a/services/src/main/java/org/keycloak/messages/MessagesSpi.java +++ b/services/src/main/java/org/keycloak/messages/MessagesSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class MessagesSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/services/src/main/java/org/keycloak/protocol/LoginProtocolSpi.java b/services/src/main/java/org/keycloak/protocol/LoginProtocolSpi.java index 6ac5496f60..2b594deafa 100755 --- a/services/src/main/java/org/keycloak/protocol/LoginProtocolSpi.java +++ b/services/src/main/java/org/keycloak/protocol/LoginProtocolSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class LoginProtocolSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/services/src/main/java/org/keycloak/protocol/ProtocolMapperSpi.java b/services/src/main/java/org/keycloak/protocol/ProtocolMapperSpi.java index 1b98e07dc8..f08e7dd665 100755 --- a/services/src/main/java/org/keycloak/protocol/ProtocolMapperSpi.java +++ b/services/src/main/java/org/keycloak/protocol/ProtocolMapperSpi.java @@ -10,8 +10,8 @@ import org.keycloak.provider.Spi; public class ProtocolMapperSpi implements Spi { @Override - public boolean isPrivate() { - return false; + public boolean isInternal() { + return true; } @Override diff --git a/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java b/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java index 0bd9f31b86..b91858ab72 100755 --- a/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java +++ b/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java @@ -4,8 +4,6 @@ import org.jboss.logging.Logger; import org.keycloak.Config; import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; -import org.keycloak.models.RealmModel; -import org.keycloak.models.RealmProvider; import org.keycloak.provider.Provider; import org.keycloak.provider.ProviderEvent; import org.keycloak.provider.ProviderEventListener; @@ -66,7 +64,7 @@ public class DefaultKeycloakSessionFactory implements KeycloakSessionFactory { Config.Scope scope = Config.scope(spi.getName(), provider); factory.init(scope); - if (spi.isPrivate() && !isInternal(factory)) { + if (spi.isInternal() && !isInternal(factory)) { log.warnv("{0} ({1}) is implementing the internal SPI {2}. This SPI is internal and may change without notice", factory.getId(), factory.getClass().getName(), spi.getName()); } @@ -78,7 +76,7 @@ public class DefaultKeycloakSessionFactory implements KeycloakSessionFactory { Config.Scope scope = Config.scope(spi.getName(), factory.getId()); factory.init(scope); - if (spi.isPrivate() && !isInternal(factory)) { + if (spi.isInternal() && !isInternal(factory)) { log.warnv("{0} ({1}) is implementing the internal SPI {2}. This SPI is internal and may change without notice", factory.getId(), factory.getClass().getName(), spi.getName()); } diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java index 4e0d8f9078..4f1c22575b 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java @@ -69,9 +69,13 @@ public class ServerInfoAdminResource { } private void setProviders(ServerInfoRepresentation info) { - Map> providers = new HashMap>(); + List providers = new LinkedList<>(); for (Spi spi : ServiceLoader.load(Spi.class)) { - providers.put(spi.getName(), session.listProviderIds(spi.getProviderClass())); + SpiInfoRepresentation spiRep = new SpiInfoRepresentation(); + spiRep.setName(spi.getName()); + spiRep.setInternal(spi.isInternal()); + spiRep.setImplementations(session.listProviderIds(spi.getProviderClass())); + providers.add(spiRep); } info.providers = providers; } @@ -197,7 +201,7 @@ public class ServerInfoAdminResource { private List protocols; private List> clientImporters; - private Map> providers; + private List providers; private List eventListeners; private Map> protocolMapperTypes; @@ -240,7 +244,7 @@ public class ServerInfoAdminResource { return clientImporters; } - public Map> getProviders() { + public List getProviders() { return providers; } @@ -265,6 +269,36 @@ public class ServerInfoAdminResource { } } + public static class SpiInfoRepresentation { + private String name; + private boolean internal; + private Set implementations; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isInternal() { + return internal; + } + + public void setInternal(boolean internal) { + this.internal = internal; + } + + public Set getImplementations() { + return implementations; + } + + public void setImplementations(Set implementations) { + this.implementations = implementations; + } + } + private static Map> createEnumsMap(Class... enums) { Map> m = new HashMap<>(); for (Class e : enums) { diff --git a/services/src/main/java/org/keycloak/wellknown/WellKnownSpi.java b/services/src/main/java/org/keycloak/wellknown/WellKnownSpi.java index 7734f48d14..564c600be1 100755 --- a/services/src/main/java/org/keycloak/wellknown/WellKnownSpi.java +++ b/services/src/main/java/org/keycloak/wellknown/WellKnownSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class WellKnownSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; } diff --git a/social/core/src/main/java/org/keycloak/social/SocialProviderSpi.java b/social/core/src/main/java/org/keycloak/social/SocialProviderSpi.java index fd500a8458..382c18d9bb 100644 --- a/social/core/src/main/java/org/keycloak/social/SocialProviderSpi.java +++ b/social/core/src/main/java/org/keycloak/social/SocialProviderSpi.java @@ -29,7 +29,7 @@ public class SocialProviderSpi implements Spi { public static final String SOCIAL_SPI_NAME = "social"; @Override - public boolean isPrivate() { + public boolean isInternal() { return false; } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/utils/ListSpi.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/utils/ListSpi.java deleted file mode 100644 index 82695bc974..0000000000 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/utils/ListSpi.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.keycloak.testsuite.utils; - -import org.keycloak.provider.Spi; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.ServiceLoader; - -/** - * @author Stian Thorgersen - */ -public class ListSpi { - - public static void main(String[] args) { - List l = new LinkedList<>(); - for (Spi s : ServiceLoader.load(Spi.class)) { - l.add(fixedLength(s.getName()) + s.isPrivate()); - } - Collections.sort(l); - System.out.println(fixedLength("SPI") + "Private"); - System.out.println("-------------------------------------"); - for (String s : l) { - System.out.println(s); - } - } - - public static String fixedLength(String s) { - while (s.length() < 30) { - s = s + " "; - } - return s; - } -} diff --git a/timer/api/src/main/java/org/keycloak/timer/TimerSpi.java b/timer/api/src/main/java/org/keycloak/timer/TimerSpi.java index ac92339573..eb70763cb4 100644 --- a/timer/api/src/main/java/org/keycloak/timer/TimerSpi.java +++ b/timer/api/src/main/java/org/keycloak/timer/TimerSpi.java @@ -10,7 +10,7 @@ import org.keycloak.provider.Spi; public class TimerSpi implements Spi { @Override - public boolean isPrivate() { + public boolean isInternal() { return true; }
SPIProviders
{{spi.name}} +
{{provider}}