8000 [OID4VCI] Default client scopes not configured correctly by tdiesler · Pull Request #47903 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
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 @@ -41,6 +41,7 @@
import org.keycloak.protocol.oid4vc.issuance.OID4VCIssuerEndpoint;
import org.keycloak.protocol.oid4vc.issuance.mappers.OID4VCSubjectIdMapper;
import org.keycloak.protocol.oid4vc.issuance.mappers.OID4VCUserAttributeMapper;
import org.keycloak.protocol.oid4vc.model.ProofType;
import org.keycloak.protocol.oidc.OIDCLoginProtocolFactory;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.ClientScopeRepresentation;
Expand All @@ -55,6 +56,8 @@
import static org.keycloak.models.ClientScopeModel.INCLUDE_IN_TOKEN_SCOPE;
import static org.keycloak.models.oid4vci.CredentialScopeModel.CRYPTOGRAPHIC_BINDING_METHODS_DEFAULT;
import static org.keycloak.models.oid4vci.CredentialScopeModel.VCT;
import static org.keycloak.models.oid4vci.CredentialScopeModel.VC_BINDING_REQUIRED;
import static org.keycloak.models.oid4vci.CredentialScopeModel.VC_BINDING_REQUIRED_PROOF_TYPES;
import static org.keycloak.models.oid4vci.CredentialScopeModel.VC_BUILD_CONFIG_HASH_ALGORITHM;
import static org.keycloak.models.oid4vci.CredentialScopeModel.VC_BUILD_CONFIG_HASH_ALGORITHM_DEFAULT;
import static org.keycloak.models.oid4vci.CredentialScopeModel.VC_BUILD_CONFIG_SD_JWT_VISIBLE_CLAIMS;
Expand All @@ -81,7 +84,6 @@ public class OID4VCLoginProtocolFactory implements LoginProtocolFactory, OID4VCE

private static final Logger LOGGER = Logger.getLogger(OID4VCLoginProtocolFactory.class);

private static final String CLIENT_ROLES_MAPPER = "client-roles";
private static final String USERNAME_MAPPER = "username";
private static final String SUBJECT_ID_MAPPER = "subject-id";
private static final String EMAIL_MAPPER = "email";
Expand Down Expand Up @@ -141,6 +143,11 @@ public void createDefaultClientScopes(RealmModel newRealm, boolean addScopesToEx
clientScope.addProtocolMapper(builtins.get(LAST_NAME_MAPPER));

ClientScopeRepresentation clientScopeRep = ModelToRepresentation.toRepresentation(clientScope);
clientScopeRep.setAttributes(new HashMap<>(Map.of(
VC_BINDING_REQUIRED, "true",
VC_BINDING_REQUIRED_PROOF_TYPES, ProofType.JWT + "," + ProofType.ATTESTATION
)));

addClientScopeDefaults(clientScopeRep);
RepresentationToModel.updateClientScope(clientScopeRep, clientScope);
}
Expand Down

This file was deleted.

Loading
Loading
0