8000 Removing deprecated EntityDescriptorClientRegistrationProvider Client Registration Provider by PadzerButch · Pull Request #55101 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/documentation/upgrading/topics/changes/changes-27_0_0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,20 @@ Updating an existing client scope does not revalidate its stored mappers.
Existing deployments continue to start, because mappers that are read from the database at startup are not validated.
If you provision realms from an exported JSON file, import the file once after upgrading to find out whether it contains a mapper that is now rejected.

=== SAML Entity Descriptor client registration endpoint removed
// https://github.com/keycloak/keycloak/issues/53478

The deprecated client registration provider `saml2-entity-descriptor` has been removed.
Requests to `/realms/<realm>/clients-registrations/saml2-entity-descriptor` now return an HTTP 404 status.

The following related APIs have also been removed:

* The `ClientRegistration.saml()` method and the `ClientRegistration.SAMLClientRegistration` class in the Java client registration API.
* The `saml2` endpoint type of the `kcreg` command-line tool. `kcreg create -e saml2` is no longer accepted, and `kcreg create` no longer treats an XML input document as a SAML entity descriptor. Use JSON input, or the `default` and `oidc` endpoint types.

To create a client from a SAML entity descriptor, convert the descriptor with the Admin REST API (`POST /admin/realms/<realm>/client-description-converter`), then create the returned client representation (`POST /admin/realms/<realm>/clients`).
The conversion endpoint itself is not affected by this change.

=== Tokens issued by the standard token exchange cannot outlive the subject token (CVE-2026-96460)
// https://github.com/keycloak/keycloak/issues/54700

Expand Down
5 changes: 2 additions & 3 deletions docs/guides/securing-apps/client-registration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ summary="Use the client registration service.">
In order for an application or service to utilize {project_name} it has to register a client in {project_name}.
An admin can do this through the admin console (or admin REST endpoints), but clients can also register themselves through the {project_name} client registration service.

The Client Registration Service provides built-in support for {project_name} Client Representations, OpenID Connect Client Meta Data and SAML Entity Descriptors.
The Client Registration Service provides built-in support for {project_name} Client Representations and OpenID Connect Client Meta Data.
The Client Registration Service endpoint is `/realms/<realm>/clients-registrations/<provider>`.

The built-in supported `providers` are:

* default - {project_name} Client Representation (JSON)
* install - {project_name} Adapter Configuration (JSON)
* openid-connect - OpenID Connect Client Metadata Description (JSON)
* saml2-entity-descriptor - SAML Entity Descriptor (XML)

The following sections will describe how to use the different providers.

Expand Down Expand Up @@ -194,7 +193,7 @@ For full instructions on using the Client Registration refer to the JavaDocs.
Below is an example of creating a client. You need to replace `eyJhbGciOiJSUz...` with a proper initial access token or bearer token.
[WARNING]
====
The `ClientRegistration` methods `reg.create()`, `reg.get()`, `reg.update()`, and `reg.delete()` target `default`; `reg.getAdapterConfig()` targets `install`; and `reg.saml().create()` targets `saml2-entity-descriptor`. These providers are deprecated since {project_name} 26.8 and will be removed in a future major release.
The `ClientRegistration` methods `reg.create()`, `reg.get()`, `reg.update()`, and `reg.delete()` target `default`, and `reg.getAdapterConfig()` targets `install`. These providers are deprecated since {project_name} 26.8 and will be removed in a future major release.
New integrations should use the replacement Admin REST API endpoints described above, or the OpenID Connect dynamic client registration endpoint for OIDC client registration.
====
[source,java,subs="attributes+"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ public static CmdStdinContext parseFileOrStdin(String file, EndpointType type) {

if (type == null) {
// guess the correct endpoint from content of the file
if (content.startsWith("<")) {
// looks like XML
type = EndpointType.SAML2;
} else if (content.startsWith("{")) {
if (content.startsWith("{")) {
// looks like JSON?
// try parse as ClientRepresentation
try {
Expand Down Expand Up @@ -130,7 +127,7 @@ public static CmdStdinContext parseFileOrStdin(String file, EndpointType type) {
}
}

// check content type, making sure it can be parsed into .json if it's not saml xml
// check content type, making sure it can be parsed into .json
if (content != null) {
try {
if (type == EndpointType.DEFAULT && client == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
public enum EndpointType {
DEFAULT("default", "default"),
OIDC("openid-connect", "oidc", "oidc"),
INSTALL("install", "install", "adapter"),
SAML2("saml2-entity-descriptor", "saml2", "saml2");
INSTALL("install", "install", "adapter");

private String endpoint;
private String preferredName;
Expand All @@ -49,8 +48,6 @@ public static EndpointType of(String name) {
return OIDC;
} else if (INSTALL.endpoint.equals(name) || INSTALL.alternativeNames.contains(name)) {
return INSTALL;
} else if (SAML2.endpoint.equals(name) || SAML2.alternativeNames.contains(name)) {
return SAML2;
}
throw new IllegalArgumentException("Endpoint not supported: " + name);
}
Expand All @@ -68,8 +65,6 @@ public static String getExpectedContentType(EndpointType type) {
case DEFAULT:
case OIDC:
return HttpUtil.APPLICATION_JSON;
case SAML2:
return HttpUtil.APPLICATION_XML;
default:
throw new RuntimeException("Unsupported endpoint type: " + type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import static org.keycloak.client.cli.util.ParseUtil.parseKeyVal;
import static org.keycloak.client.registration.cli.EndpointType.DEFAULT;
import static org.keycloak.client.registration.cli.EndpointType.OIDC;
import static org.keycloak.client.registration.cli.EndpointType.SAML2;
import static org.keycloak.client.registration.cli.KcRegMain.CMD;
import static org.keycloak.common.util.IoUtils.readPasswordFromConsole;

Expand All @@ -65,7 +64,7 @@ public class CreateCmd extends AbstractAuthOptionsCmd {
@Option(names = {"-i", "--clientId"}, description = "After creation only print clientId to standard output")
protected boolean returnClientId = false;

@Option(names = {"-e", "--endpoint"}, description = "Endpoint type / document format to use - one of: 'default', 'oidc', 'saml2'", converter = EndpointTypeConverter.class)
@Option(names = {"-e", "--endpoint"}, description = "Endpoint type / document format to use - one of: 'default', 'oidc'", converter = EndpointTypeConverter.class)
protected EndpointType regType;

@Option(names = {"-f", "--file"}, description = "Read object from file or standard input if FILENAME is set to '-'")
Expand Down Expand Up @@ -153,7 +152,7 @@ protected void process() {
contentType, HttpUtil.APPLICATION_JSON, ctx.getContent(), auth);

try {
if (ctx.getEndpointType() == DEFAULT || ctx.getEndpointType() == SAML2) {
if (ctx.getEndpointType() == DEFAULT) {
ClientRepresentation client = JsonSerialization.readValue(response, ClientRepresentation.class);
outputResult(client.getClientId(), client);

Expand Down Expand Up @@ -209,7 +208,7 @@ protected String help() {
out.println(" -t, --token TOKEN Use the specified Initial Access Token for authorization or read it from standard input ");
out.println(" if '-' is specified. This overrides any token set by '" + CMD + " config initial-token'.");
out.println(" If not specified, session credentials are used - see: CREDENTIALS OPTIONS.");
out.println(" -e, --endpoint TYPE Endpoint type / document format to use - one of: 'default', 'oidc', 'saml2'.");
out.println(" -e, --endpoint TYPE Endpoint type / document format to use - one of: 'default', 'oidc'.");
out.println(" If not specified, the format is deduced from input file or falls back to 'default'.");
out.println(" -s, --set NAME=VALUE Set a specific attribute NAME to a specified value VALUE");
out.println(" -f, --file FILENAME Read object from file or standard input if FILENAME is set to '-'");
Expand All @@ -231,7 +230,7 @@ protected String help() {
}
out.println();
out.println("Since we didn't specify an endpoint type it will be deduced from configuration format.");
out.println("Supported formats include Keycloak default format, OIDC format, and SAML SP Metadata.");
out.println("Supported formats include Keycloak default format and OIDC format.");
out.println();
out.println("Creating a client using file as a template, and overriding some attributes:");
out.println(" " + PROMPT + " " + CMD + " create -f my_client.json -s clientId=my_client2 -s 'redirectUris=[\"http://localhost:8980/myapp/*\"]'");
Expand All @@ -242,10 +241,6 @@ protected String help() {
out.println("Creating a client using 'oidc' endpoint. Without setting endpoint type here it would be 'default':");
out.println(" " + PROMPT + " " + CMD + " create -e oidc -s 'redirect_uris=[\"http://localhost:8980/myapp/*\"]'");
out.println();
out.println("Creating a client using 'saml2' endpoint. In this case setting endpoint type is redundant since it is deduced ");
out.println("from file content:");
out.println(" " + PROMPT + " " + CMD + " create -e saml2 -f saml-sp-metadata.xml");
out.println();
out.println();
out.println("Use '" + CMD + " help' for general information and a list of commands");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ protected void process() {
result = JsonSerialization.readValue(json, AdapterConfig.class);
break;
}
case SAML2: {
break;
}
default: {
throw new RuntimeException("Unexpected type: " + regType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ protected void process() {
//
// We could also support environment variables in input file, and apply them before parsing it.
//
// One problem - what if it is SAML XML? No problem as we don't support update for SAML - only create.
//
if (file == null && attrs.size() > 0) {
mergeMode = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ public class ClientRegistration {
}

private final String JSON = "application/json";
private final String XML = "application/xml";

private final String DEFAULT = "default";
private final String INSTALLATION = "install";
private final String OIDC = "openid-connect";
private final String SAML = "saml2-entity-descriptor";

private HttpUtil httpUtil;

Expand Down Expand Up @@ -108,10 +106,6 @@ public OIDCClientRegistration oidc() {
return new OIDCClientRegistration();
}

public SAMLClientRegistration saml() {
return new SAMLClientRegistration();
}

public static String serialize(Object obj) throws ClientRegistrationException {
try {
return outputMapper.writeValueAsString(obj);
Expand Down Expand Up @@ -157,15 +151,6 @@ public void delete(String clientId) throws ClientRegistrationException {

}

public class SAMLClientRegistration {

public ClientRepresentation create(String entityDescriptor) throws ClientRegistrationException {
InputStream resultStream = httpUtil.doPost(entityDescriptor, XML, UTF_8, JSON, SAML);
return deserialize(resultStream, ClientRepresentation.class);
}

}

public static class ClientRegistrationBuilder {

private String url;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ private void checkClientProtocol() {
}

private void checkClientProtocol(ClientModel client) {
if (endpoint.equals("openid-connect") || endpoint.equals("saml2-entity-descriptor")) {
if (endpoint.equals("openid-connect")) {
if (client != null && !endpoint.contains(client.getProtocol())) {
throw new ErrorResponseException(Errors.INVALID_CLIENT, "Wrong client protocol.", Response.Status.BAD_REQUEST);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ClientRegistrationService {

private final KeycloakSession session;

private static final Set<String> DEPRECATED_PROVIDER_IDS = Set.of("default", "install", "saml2-entity-descriptor");
private static final Set<String> DEPRECATED_PROVIDER_IDS = Set.of("default", "install");

public ClientRegistrationService(KeycloakSession session, EventBuilder event) {
this.session = session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
org.keycloak.services.clientregistration.DefaultClientRegistrationProviderFactory
org.keycloak.services.clientregistration.oidc.OIDCClientRegistrationProviderFactory
org.keycloak.services.clientregistration.AdapterInstallationClientRegistrationProviderFactory
org.keycloak.protocol.saml.clientregistration.EntityDescriptorClientRegistrationProviderFactory
Loading
Loading
0