use of it.spid.cie.oidc.exception.TrustChainBuilderException in project spid-cie-oidc-java by italia.
the class TrustChainBuilder method processSubjectConfiguration.
/**
* Ensure the provided Subject Entity Configuration is valid (self validable) and
* complete (at least by required elements)
*
* @throws OIDCException
*
* @throws OIDCException
*/
protected void processSubjectConfiguration() throws OIDCException {
if (subjectConfiguration != null) {
return;
}
try {
String jwt = EntityHelper.getEntityConfiguration(subject);
subjectConfiguration = new EntityConfiguration(jwt, trustAnchorConfiguration, jwtHelper);
subjectConfiguration.validateItself();
} catch (Exception e) {
String msg = String.format("Entity Configuration for %s failed: %s", subject, e.getMessage());
logger.error(msg);
throw new TrustChainBuilderException(msg);
}
if (requiredTrustMasks.length > 0) {
subjectConfiguration.setAllowedTrustMarks(requiredTrustMasks);
if (!subjectConfiguration.validateByAllowedTrustMarks()) {
throw new TrustChainException.InvalidRequiredTrustMark("The required Trust Marks are not valid");
}
this.verifiedTrustMasks.addAll(subjectConfiguration.getVerifiedTrustMarks());
}
}
Aggregations