Added context aliases and versioning
This commit is contained in:
parent
08c5671342
commit
433032c6c3
@ -148,6 +148,14 @@ public class Assertion extends Credential {
|
|||||||
public List<Validation> getValidations() {
|
public List<Validation> getValidations() {
|
||||||
return validationMap.get(this);
|
return validationMap.get(this);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, List<String>> getContextAliases() {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, List<String>> getContextVersionPatterns() {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ValueType {
|
public enum ValueType {
|
||||||
|
@ -92,6 +92,8 @@ public abstract class Credential extends GeneratedObject {
|
|||||||
List<String> getAllowedTypeValues();
|
List<String> getAllowedTypeValues();
|
||||||
boolean isAllowedTypeValuesRequired();
|
boolean isAllowedTypeValuesRequired();
|
||||||
List<String> getContextUris();
|
List<String> getContextUris();
|
||||||
|
Map<String, List<String>> getContextAliases();
|
||||||
|
Map<String, List<String>> getContextVersionPatterns();
|
||||||
String toString();
|
String toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,17 +53,24 @@ public class VerifiableCredential extends Credential {
|
|||||||
private static final Map<Set<VerifiableCredential.Type>, List<String>> contextMap = new ImmutableMap.Builder<Set<VerifiableCredential.Type>, List<String>>()
|
private static final Map<Set<VerifiableCredential.Type>, List<String>> contextMap = new ImmutableMap.Builder<Set<VerifiableCredential.Type>, List<String>>()
|
||||||
.put(Set.of(Type.OpenBadgeCredential, AchievementCredential, EndorsementCredential),
|
.put(Set.of(Type.OpenBadgeCredential, AchievementCredential, EndorsementCredential),
|
||||||
List.of("https://www.w3.org/2018/credentials/v1",
|
List.of("https://www.w3.org/2018/credentials/v1",
|
||||||
//"https://purl.imsglobal.org/spec/ob/v3p0/context.json")) //dev legacy
|
|
||||||
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"))
|
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"))
|
||||||
.put(Set.of(ClrCredential),
|
.put(Set.of(ClrCredential),
|
||||||
List.of("https://www.w3.org/2018/credentials/v1",
|
List.of("https://www.w3.org/2018/credentials/v1",
|
||||||
// "https://dc.imsglobal.org/draft/clr/v2p0/context", //dev legacy
|
|
||||||
// "https://purl.imsglobal.org/spec/ob/v3p0/context.json")) //dev legacy
|
|
||||||
"https://purl.imsglobal.org/spec/clr/v2p0/context.json",
|
"https://purl.imsglobal.org/spec/clr/v2p0/context.json",
|
||||||
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"))
|
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"))
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
private static final Map<String, List<String>> contextAliasesMap = new ImmutableMap.Builder<String, List<String>>()
|
||||||
|
.put("https://purl.imsglobal.org/spec/ob/v3p0/context.json",
|
||||||
|
List.of("https://purl.imsglobal.org/spec/ob/v3p0/context/ob_v3p0.jsonld"))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
private static final Map<String, List<String>> contextVersioningPatternMap = new ImmutableMap.Builder<String, List<String>>()
|
||||||
|
.put("https://purl.imsglobal.org/spec/ob/v3p0/context.json",
|
||||||
|
List.of("https:\\/\\/purl\\.imsglobal\\.org\\/spec\\/ob\\/v3p0\\/context(-\\d+\\.\\d+\\.\\d+)*\\.json"))
|
||||||
|
.build();
|
||||||
|
|
||||||
public enum Type implements CredentialEnum {
|
public enum Type implements CredentialEnum {
|
||||||
AchievementCredential(Collections.emptyList()),
|
AchievementCredential(Collections.emptyList()),
|
||||||
OpenBadgeCredential(List.of("OpenBadgeCredential", "AchievementCredential")), //treated as an alias of AchievementCredential
|
OpenBadgeCredential(List.of("OpenBadgeCredential", "AchievementCredential")), //treated as an alias of AchievementCredential
|
||||||
@ -119,6 +126,14 @@ public class VerifiableCredential extends Credential {
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(()-> new IllegalArgumentException(this.name() + " not recognized")));
|
.orElseThrow(()-> new IllegalArgumentException(this.name() + " not recognized")));
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, List<String>> getContextAliases() {
|
||||||
|
return contextAliasesMap;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, List<String>> getContextVersionPatterns() {
|
||||||
|
return contextVersioningPatternMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ProofType {
|
public enum ProofType {
|
||||||
|
Loading…
Reference in New Issue
Block a user