Class OID4VCMapper

java.lang.Object
org.keycloak.protocol.oid4vc.issuance.mappers.OID4VCMapper
All Implemented Interfaces:
OID4VCEnvironmentProviderFactory, ProtocolMapper, ConfiguredProvider, EnvironmentDependentProviderFactory, Provider, ProviderFactory<ProtocolMapper>
Direct Known Subclasses:
OID4VCContextMapper, OID4VCGeneratedIdMapper, OID4VCIssuedAtTimeClaimMapper, OID4VCStaticClaimMapper, OID4VCSubjectIdMapper, OID4VCTargetRoleMapper, OID4VCTypeMapper, OID4VCUserAttributeMapper

public abstract class OID4VCMapper extends Object implements ProtocolMapper, OID4VCEnvironmentProviderFactory
Base class for OID4VC Mappers, to provide common configuration and functionality for all of them
Author:
Stefan Wiedemann
  • Field Details

  • Constructor Details

    • OID4VCMapper

      public OID4VCMapper()
  • Method Details

    • getIndividualConfigProperties

      protected abstract List<ProviderConfigProperty> getIndividualConfigProperties()
    • getConfigProperties

      public List<ProviderConfigProperty> getConfigProperties()
      Specified by:
      getConfigProperties in interface ConfiguredProvider
    • setMapperModel

      public OID4VCMapper setMapperModel(ProtocolMapperModel mapperModel, String format)
    • includeInMetadata

      public boolean includeInMetadata()
      some specific claims should not be added into the metadata. Examples are jti, sub, iss etc. Since we have the possibility to add these credentials with specific claims we should also be able to exclude these specific attributes from the metadata
    • getMetadataAttributePath

      public List<String> getMetadataAttributePath()
      must return ordered list of attribute-names as they are added into the credential. This is required for the metadata endpoint to add the appropriate path-attributes into the claim's description.
      Returns:
      the attribute path that is being mapped into the credential
    • getAttributePrefix

      protected List<String> getAttributePrefix()
    • getProtocol

      public String getProtocol()
      Specified by:
      getProtocol in interface ProtocolMapper
    • getDisplayCategory

      public String getDisplayCategory()
      Specified by:
      getDisplayCategory in interface ProtocolMapper
    • init

      public void init(Config.Scope scope)
      Description copied from interface: ProviderFactory
      Only called once when the factory is first created.
      Specified by:
      init in interface ProviderFactory<ProtocolMapper>
    • postInit

      public void postInit(KeycloakSessionFactory keycloakSessionFactory)
      Description copied from interface: ProviderFactory
      Called after all provider factories have been initialized
      Specified by:
      postInit in interface ProviderFactory<ProtocolMapper>
    • close

      public void close()
      Description copied from interface: ProviderFactory
      This is called when the server shuts down.
      Specified by:
      close in interface Provider
      Specified by:
      close in interface ProviderFactory<ProtocolMapper>
    • setClaim

      public abstract void setClaim(VerifiableCredential verifiableCredential, UserSessionModel userSessionModel)
      Set the claims to credential, like f.e. the context
    • setClaim

      public abstract void setClaim(Map<String,Object> claims, UserSessionModel userSessionModel)
      Set the claims to the credential subject.
    • setClaimWithMetadataPrefix

      public void setClaimWithMetadataPrefix(Map<String,Object> claimsOrig, Map<String,Object> claimsWithPrefix)
      Creates new map "claimsWithPrefix" with the resolved claims including path prefix
      Parameters:
      claimsOrig - Map with the original claims, which were returned by setClaim(Map, UserSessionModel) . This method usually just reads from this map
      claimsWithPrefix - Map with the claims including path prefix. This method might write to this map