func ValidateAllowedForAuth(resolverClient ResolverClient, issuer *Issuer, subjectID string) error {
	return checkAllowOnDocOrController(resolverClient, issuer, subjectID, true)
}
ValidateAllowedForAuth Validate if issuer is allowed for authentication on the register document associated to the subject.
package register
import (
	"fmt"
)
func IsAllowFor(resolverClient ResolverClient, issuer *Issuer, issuerDoc *RegisterDocument, subjectDoc *RegisterDocument, includeAuth bool) (bool, error) {
	if issuerDoc.Revoked || subjectDoc.Revoked {
		return false, fmt.Errorf("issuer or subject document revoked")
	}
	if issuerDoc.ID == subjectDoc.ID {  
		issuerKey, _ := GetIssuerRegisterKey(issuer.Name, subjectDoc, includeAuth)
		if issuerKey != nil && !issuerKey.Revoked {
			return true, nil
		}
	}
	delegationProof, err := GetIssuerRegisterDelegationProofByController(issuer.String(), subjectDoc, includeAuth)
	if err != nil {
		return false, err
	}
	if !delegationProof.Revoked {
		err := ValidateDelegation(resolverClient, subjectDoc.ID, delegationProof)
		return err == nil, err
	}
	return false, fmt.Errorf("delegation proof revoked")
}
func checkAllowOnDocOrController(resolverClient ResolverClient, issuer *Issuer, subjectID string, includeAuth bool) error {
	issuerDoc, err := resolverClient.GetDocument(issuer.Did)
	if err != nil {
		return err
	}
	subjectDoc, err := resolverClient.GetDocument(subjectID)
	if err != nil {
		return err
	}
	if allowed, err := IsAllowFor(resolverClient, issuer, issuerDoc, subjectDoc, includeAuth); allowed {
		return nil
	} else if IsResolverError(err) {
		return err
	}
	if subjectDoc.Controller != "" {
		controllerDoc, err := resolverClient.GetDocument(subjectDoc.Controller)
		if err != nil {
			return err
		}
		if allowed, err := IsAllowFor(resolverClient, issuer, issuerDoc, controllerDoc, includeAuth); allowed {
			return nil
		} else if IsResolverError(err) {
			return err
		}
	}
	return fmt.Errorf("not allowed")
}
func ValidateAllowedForControl(resolverClient ResolverClient, issuer *Issuer, subjectID string) error {
	return checkAllowOnDocOrController(resolverClient, issuer, subjectID, false)
}