8000 adding some notes about v2 default handling by shawkins · Pull Request #39547 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;

import java.util.LinkedHashSet;
import java.util.Set;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonInclude(JsonInclude.Include.NON_ABSENT)
public class ClientRepresentation {

public static final String OIDC = "openid-connect";

@JsonProperty(required = true)
@JsonPropertyDescription("ID uniquely identifying this client")
private String clientId;
Expand All @@ -19,30 +22,36 @@ public class ClientRepresentation {
@JsonPropertyDescription("Human readable description of the client")
private String description;

@JsonProperty(defaultValue = OIDC)
@JsonPropertyDescription("The protocol used to communicate with the client")
private String protocol;
private String protocol = OIDC;

@JsonPropertyDescription("Whether this client is enabled")
private Boolean enabled;

@JsonPropertyDescription("URL to the application's homepage that is represented by this client")
private String appUrl;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyDescription("URLs that the browser can redirect to after login")
private Set<String> appRedirectUrls;
private Set<String> appRedirectUrls = new LinkedHashSet<String>();

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyDescription("Login flows that are enabled for this client")
private Set<String> loginFlows;
private Set<String> loginFlows = new LinkedHashSet<String>();

@JsonPropertyDescription("Authentication configuration for this client")
private Auth auth;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyDescription("Web origins that are allowed to make requests to this client")
private Set<String> webOrigins;
private Set<String> webOrigins = new LinkedHashSet<String>();

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyDescription("Roles associated with this client")
private Set<String> roles;
private Set<String> roles = new LinkedHashSet<String>();

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyDescription("Service account configuration for this client")
private ServiceAccount serviceAccount;

Expand Down Expand Up @@ -81,6 +90,9 @@ public String getProtocol() {
}

public void setProtocol(String protocol) {
if (protocol == null) {
protocol = OIDC;
}
this.protocol = protocol;
}

Expand Down Expand Up @@ -148,7 +160,7 @@ public void setServiceAccount(ServiceAccount serviceAccount) {
this.serviceAccount = serviceAccount;
}

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonInclude(JsonInclude.Include.NON_ABSENT)
public static class Auth {

@JsonPropertyDescription("Whether authentication is enabled for this client")
Expand Down Expand Up @@ -196,14 +208,15 @@ public void setCertificate(String certificate) {
}
}

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonInclude(JsonInclude.Include.NON_ABSENT)
public static class ServiceAccount {

@JsonPropertyDescription("Whether the service account is enabled")
private Boolean enabled;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonPropertyDescription("Roles assigned to the service account")
private Set<String> roles;
private Set<String> roles = new LinkedHashSet<String>();

public Boolean getEnabled() {
return enabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,26 @@

public interface ClientService extends Service {

Optional<ClientRepresentation> getClient(RealmModel realm, String clientId);
public static class ClientSearchOptions {
// TODO
}

Optional<ClientRepresentation> getClient(RealmModel realm, String clientId, Boolean fullRepresentation);
public static class ClientProjectionOptions {
Boolean fullRepresentation;

Stream<ClientRepresentation> getClients(RealmModel realm);
// TODO
}

ClientRepresentation createOrUpdateClient(RealmModel realm, ClientRepresentation client) throws ServiceException;
Optional<ClientRepresentation> getClient(RealmModel realm, String clientId, ClientProjectionOptions projectionOptions);

Stream<ClientRepresentation> getClients(RealmModel realm, ClientProjectionOptions projectionOptions, ClientSearchOptions searchOptions);

ClientRepresentation deleteClient(RealmModel realm, String clientId);

Stream<ClientRepresentation> deleteClients(RealmModel realm, ClientSearchOptions searchOptions);

ClientRepresentation createOrUpdateClient(RealmModel realm, String clientId, ClientRepresentation client) throws ServiceException;

ClientRepresentation createClient(RealmModel realm, ClientRepresentation client) throws ServiceException;

}
0