Search in sources :

Example 1 with TrustChainBuilderException

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());
    }
}
Also used : TrustChainBuilderException(it.spid.cie.oidc.exception.TrustChainBuilderException) OIDCException(it.spid.cie.oidc.exception.OIDCException) TrustChainException(it.spid.cie.oidc.exception.TrustChainException) TrustChainBuilderException(it.spid.cie.oidc.exception.TrustChainBuilderException)

Aggregations

OIDCException (it.spid.cie.oidc.exception.OIDCException)1 TrustChainBuilderException (it.spid.cie.oidc.exception.TrustChainBuilderException)1 TrustChainException (it.spid.cie.oidc.exception.TrustChainException)1