public bool IsValid(IPermissionValidationInfo info) { if (info == null) { return(true); } if (!IsAuthenticated) { return(false); } var adapters = this.Adapters.Where(a => a.IsAdaptFor(info)).ToList(); if (adapters.Count <= 0) { throw new InstanceNotFoundException($"Authentication Adapter for {info.GetType().FullName} is not found."); } return(adapters.Any(a => a.Validate(info))); }
public virtual bool Validate(IPermissionValidationInfo validationInfo) { Guard.ArgumentIsNotNull(validationInfo, nameof(validationInfo)); if (IsAdaptFor(validationInfo)) { return(Validate(validationInfo as TValidationInfo)); } throw new NotSupportedException($"The Authentication Adapter {this.GetType().FullName} is not supporting {validationInfo.GetType().FullName}"); }